> <?
> $c = "0";
> select($c, $id);
>
>
> function select($c, $id) {
> global $name, $db;
> $sql = "select * from ref_directory where parent_id = '$id'";
> $results = pg_exec($db, $sql);
> if (!$result) {printf ("ERROR"); exit;}
> for ($pos=0;$pos<pg_numrows($result);$pos++) {
> $row = pg_fetch_array($result,$pos);
> $id = $row["id"];
> if ($result){
> $c++;
> $name[$c] = $row[vir_dir_name];
.........................^^^^^^^^^^^^
What is that?
a) a variable; then you must write $row[$vir_dir_name]
b) a string; then you should write $row["vir_dir_name"]
You should know, that variables from outside a function are not visible
inside a function:
$name = "Moritz";
function print()
{
echo $name;
}
will produce *nothing*;
Instead you must write it like:
$name = "Moritz";
function print()
{
global $name;
echo $name;
}
(normally a function should not access a variable from outside, but
sometimes there is no other way...)
Hope it helps,
Moritz.
> select($c, $id);
> }
> $var = 0
> while $var < $c {
> echo "<option value=\"".$id."\">".$name[$var]."</option>\n";
> }
> }
> ?>
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]