Justtechjobs.com Find a programming school near you






Online Campus Both


php-db | 2001041

RE: [PHP-DB] How to limit a WHILE statement? From: Brian Hardwick (bhardwick <email protected>)
Date: 04/02/01

Your might want to consider limiting the records selected. For example
"select emp_name from employees limit 0,20".

Alternatively consider using a a "for" statement.

- Brian Hardwick
Tangible Networks.

-----Original Message-----
From: Bob Stone [mailto:bstone98 <email protected>]
Sent: Monday, April 02, 2001 6:53 PM
To: php-db <email protected>
Subject: [PHP-DB] 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

__________________________________________________
Do You Yahoo!?
Get email at your own domain with Yahoo! Mail.
http://personal.mail.yahoo.com/?.refer=text

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: php-db-unsubscribe <email protected>
For additional commands, e-mail: php-db-help <email protected>
To contact the list administrators, e-mail: php-list-admin <email protected>

-- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-db-unsubscribe <email protected> For additional commands, e-mail: php-db-help <email protected> To contact the list administrators, e-mail: php-list-admin <email protected>