note 22115 deleted from function.msql-fetch-array by didou
| From: | didou@php.net | Date: | Mon, 04 Apr 2005 22:10:25 +0000 |
| Subject: | note 22115 deleted from function.msql-fetch-array by didou | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-87467@lists.php.net to get a copy of this message | ||
Note Submitter: daevid at daevid dot com
----
$result = mysql_query("SELECT name, email, url FROM mytable where id = 42", $linkid);
if (!$result) { echo mysql_errno().": ".mysql_error()."\n"; exit; }
if (mysql_num_rows($result) == 1)
{
$row = mysql_fetch_array($result,MYSQL_ASSOC);
while(list($myVariableName,$sqlFieldName)=each($row)) { $$myVariableName = $sqlFieldName; }
}
//now all the data for row 42 is in $name, $email, $url