Re: problem looping through records
| From: | Curt Zirzow | Date: | Sun, 10 Aug 2003 21:55:36 +0000 |
| Subject: | Re: problem looping through records | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-159063@lists.php.net to get a copy of this message | ||
* Thus wrote Huzz (huzz@bangladeshimatch.com):
> I have a sql statement which brings about 15 records... inside the while
> loop i am trying to get data from another table by passing an id, the
> problem is i am only getting the first record .. not the whole 15 records..
>
> any suggestion??
>
> function list_ss_cats(){
> global $db;
> $sql = "SELECT DISTINCT(new_cat) FROM logos WHERE format =3";
> $result = $db->sql_query($sql);
> $num = $db->sql_numrows();
> while($row = $db->sql_fetchrow()){
I'm not sure how this little db class works, but fetchrow needs
to know what result handle it is fetching from.
>
> $sql2 = "SELECT * FROM cats WHERE id='$row[new_cat]'";
>
> $result1 = $db->sql_query($sql2);
>
HTH,
Curt
--
"I used to think I was indecisive, but now I'm not so sure."