note 13815 deleted from language.variables.scope by jimw
| From: | jimw@php.net | Date: | Sat, 08 Dec 2001 21:44:02 +0000 |
| Subject: | note 13815 deleted from language.variables.scope by jimw | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-22224@lists.php.net to get a copy of this message | ||
Another couple of words about the above method, there are advantages and disadvantages.
1) As all results are now available "before you need them" from the array, you can
reference generic data from all rows (such as a common identifier) without having to explicitly pull
out the first row.
2) You don't need to worry about changing from "SELECT *" to explicitly stating which
columns you wish to return: you access the columns by their headers, not by their offset (although
this is also true of mysql_fetch_array).
3) You can't reference a two dimensional array through a quoted echo (or other output
function), and so must unquote your echo and catenate in the array (e.g: echo "Result: " .
$db_data["name"][0] . "\<BR\>";
4) Reading all that data into an array is essentially creating a duplicate of all that data, and
thus doubling the memory requirements of your data.
You can use mysql_free_result() to release the data from the original query, BUT...
5) You can then no longer perform database functions on that result set. The way around this is to
program that functionality into the generic function, but you are then creating redundancy (which
may possibly slow the function down).