RE: [PHP] How to limit a WHILE statement?
| From: | Jason Lotito | Date: | Tue, 03 Apr 2001 02:18:54 +0000 |
| Subject: | RE: [PHP] How to limit a WHILE statement? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-46702@lists.php.net to get a copy of this message | ||
> -----Original Message-----
> From: Bob Stone [mailto:bstone98@yahoo.com]
> Sent: Monday, April 02, 2001 3:54 PM
> To: php-general@lists.php.net
> Subject: [PHP] How to limit a WHILE statement?
>
>
> Dear PHP Helpers,
>
> What is your recommendation on limiting a while
> statement so that it only iterates a maximum of 20
> times?
>
> Here is the code snippet:
>
> $result = mysql_query($sql, $db);
>
> while ($myrow = mysql_fetch_array($result)) {
>
> printf("Name: <b><font color=\"green\" size=\"5s\">%s
> %s %s %s\n<br></b></font>", $myrow["salutation"],
> $myrow["first_name"], $myrow["mid_name"],
> $myrow["user_name"]);
>
> Best regards,
>
> Bob Stone
Limit the results returned in the actual SQL to 20 results.
Jason Lotito
www.NewbieNetwork.net
Where those who can, teach;
and those who can, learn.