note 26082 added to function.mysql-result
| From: | se at rack1 dot php dot net | Date: | Thu, 17 Oct 2002 10:05:35 +0000 |
| Subject: | note 26082 added to function.mysql-result | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-38199@lists.php.net to get a copy of this message | ||
If you wish to select a field value in a SQL statement like:
$sql = "SELECT uid FROM global_lookup WHERE id='$fid'";
$result = mysql_query($sql, $db) or die($sql."->".mysql_error());
This is quicker:
return @mysql_result($result,0);
than:
$row = mysql_fetch_array($result);
return $row["uid"];
In both cases, 'uid' is returned if it exists, otherwise NULL.
--
http://www.php.net/manual/en/function.mysql-result.php
http://master.php.net/manage/user-notes.php?action=edit+26082
http://master.php.net/manage/user-notes.php?action=delete+26082
http://master.php.net/manage/user-notes.php?action=reject+26082