note 26766 added to function.mysql-fetch-array
| From: | juancri at rack1 dot php dot net | Date: | Tue, 12 Nov 2002 07:41:46 +0000 |
| Subject: | note 26766 added to function.mysql-fetch-array | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-39365@lists.php.net to get a copy of this message | ||
An example with mysql_fetch_array():
$result = mysql_query("SELECT name FROM table WHERE id=8");
$array = mysql_fetch_array($result);
$array will be:
array ([0] => "John", ['name'] => "John")
Then you can access to the results:
echo "The name is " . $array[0];
// or
echo "The name is " . $array['name'];
But the array is not referential. $array[0] is not a reference to $array['name'] or
$array['name'] to $array[0], they are not relationed between. Because of that, the system
will use excesive memory. With large columns, try to use mysql_fetch_assoc() or mysql_fetch_row()
only.
--
http://www.php.net/manual/en/function.mysql-fetch-array.php
http://master.php.net/manage/user-notes.php?action=edit+26766
http://master.php.net/manage/user-notes.php?action=delete+26766
http://master.php.net/manage/user-notes.php?action=reject+26766