Click to See Complete Forum and Search --> : invalid arguments error


zuzupus
08-08-2003, 05:18 AM
hi,
iam getting error when using foreach()

**Invalid argument supplied for foreach() **
is it right way to use JOIN and let say value of fk_t_directories=312 so i tried to use <?=$r->sys_pk ?>
as this value im getting from

query_db("SELECT info FROM t_directories");
while($r = foreach_db())
{
$info[$r->sys_pk] = $r;
}

query_db("SELECT u.name,u.sys_pk FROM t_user u INNER JOIN tr_directories_user r ON r.fk_t_user=u.sys_pk WHERE r.fk_t_directories='<?=$r->sys_pk ?>'");
while($q = foreach_db())
{
$names[$q->sys_pk] = $q;
}

and with this querry i want to get value in my field

<td>CLients</td>
<? foreach($names as $q) { ?>//getting error in this line
<tr>
<td class="black2">
<input type="radio" name="user" value="<?=$r->sys_pk ?>" id="<?="dir{$r->sys_pk}" ?>" /> <label for="<?="dir{$r->sys_pk}" ?>"><?=htmlentities($q->name) ?></label>
</td>
</tr>
<? } ?>

Clients apple//these values coming from JOIn querry
ibm
MS

anybod figure out the solution be really appreciable

thanks

DaiWelsh
08-08-2003, 09:29 AM
That depends entirely on what the query_db and foreach_db functions do, I am not aware of them being built in PHP functions so I assume you have defined them somewhere?

Dai