Thanks for your kind reply, John. I've not used the variable variable
technique before but do recall reading about it in the PHP Bible.
I'll give it a try.
John Krewson <[EMAIL PROTECTED]>
11/24/2003 01:33 PM
Re: [PHP-DB] Extracting values from an array (I think)
If you have to assign 24 unique variables rather than storing this data
in an array, then you could apply some variable variable action. Here
is a code sample that assumes you are looping through a result set from
query ="SELECT short_label FROM config ORDER BY meter_num";
or die("Can't connect or something painfully obscure");
while($row = mysql_fetch_assoc($result))
That will, I believe, give you a list of variables/values such as:
$short_label_1 = short_label_1
$short_label_2 = short_label_2
You can also adjust the variable name to your liking, such as:
The above should be correct, but I do admit that I don't use this
To bad you cannot just throw your values into an associative array and
pluck them when needed
using $key => $value type of combinations.
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php