Nizzan
|
Posted: 06/07/2004, 10:37 AM |
|
In normal php I'll do this;
$sql = 'select friend_id from friends where user_id = 1';
$result = mysql_query($sql);
while($row = mysql_fetch_array($result)){
$sql2 = 'select * from items where friend_id = ' . $row['friend_id'];
$result2 = mysql_query($sql);
while($row = mysql_fetch_array($result)){
DO GRID ROWS HERE
}
}
Only friends of user id 1 items will be shown. These friends will have
different id.
Thanks,
|
|
|
Nizzan
|
Posted: 06/07/2004, 10:40 AM |
|
There are missing text on the top. Sorry.
What I really need is a way to loop mysql query a few time to produce the
desired output.
"Nizzan" <nizzan@salsabil.biz> wrote in message
news:ca294l$49q$1@news.codecharge.com...
> In normal php I'll do this;
>
> $sql = 'select friend_id from friends where user_id = 1';
> $result = mysql_query($sql);
> while($row = mysql_fetch_array($result)){
> $sql2 = 'select * from items where friend_id = ' . $row['friend_id'];
> $result2 = mysql_query($sql);
> while($row = mysql_fetch_array($result)){
> DO GRID ROWS HERE
> }
> }
>
> Only friends of user id 1 items will be shown. These friends will have
> different id.
>
> Thanks,
>
>
|
|
|
Last Hero
|
Posted: 06/08/2004, 6:42 AM |
|
Hm...
Please read some articles about relational databases.
You does not need second WHILE.
Read about SELECT with JOIN clause.
CCS can make datasource on few joined tables.
|
|
|
|