Re: Is While needed in MySQL Result with a Limit of 1
| From: | Luke van Blerk | Date: | Wed, 10 Apr 2002 12:06:46 +0000 |
| Subject: | Re: Is While needed in MySQL Result with a Limit of 1 | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-92373@lists.php.net to get a copy of this message | ||
No its not.
mysql_fetch_array will return an array if a record is found or false if not.
Regards
Luke
----- Original Message -----
From: "Brian Drexler" <sysadmin@saginawcontrol.com>
To: "Php-General@Lists. Php. Net" <php-general@lists.php.net>
Sent: Wednesday, April 10, 2002 1:58 PM
Subject: [PHP] Is While needed in MySQL Result with a Limit of 1
> Here is my code:
>
> mysql_connect("localhost","username","password");
> $result=mysql_db_query("Database","select * from table_name where
> criteria=whatever limit 1");
> while($r=mysql_fetch_array($result) {
> $Value1=$r["TableFieldName1"];
> $Value2=$r["TableFieldName2"];
> echo "$Value1, $Value2";
> }
>
> My question is this....is the while statement needed when I'm only
returning
> one record?
>
> Brian
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>