RE: [PHP] more results (loop)
| From: | Jon Haworth | Date: | Fri, 11 Apr 2003 14:20:31 +0000 |
| Subject: | RE: [PHP] more results (loop) | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-143505@lists.php.net to get a copy of this message | ||
Hi Sebastian,
> how do i get more results when the echo is not
> in the while loop?
You'll have to use different variables from $row and $result2 to handle the
other queries inside the loop, but move this bit:
> // other queries....
> echo "$title <br/> $text";
Inside this bit:
> while($row = mysql_fetch_row($result2)) {
> $title = $row[2];
> $text = $row[3];
> }
You'll also need to change "mysql_fetch_row" to "mysql_fetch_array".
Having multiple queries inside a loop is often a sign of a database or query
design that could be improved - you might want to play around with some
joins to try and get all the information you need in one bigger query.
HTH
Jon