Re: array in db field -> actual array

From: Date: Thu, 13 Sep 2001 11:41:32 +0000
Subject: Re: array in db field -> actual array
References: 1 2  Groups: php.db 
Request: Send a blank email to php-db+get-12403@lists.php.net to get a copy of this message
scratch that, i had a syntax error in the array.. you were completely right dobromir eval() works perfectly.. thanks!!!!! Brendan wrote:
thanks dobromir, unfortunately that doesnt seem to work ... although looking at the php manual you seem to be on the right track.. could the way the textfield is parsed & passed back affect the array? cheers! brendan Dobromir Velev wrote:
Hi, I think you can use the eval() function to execute the stored info. The code will look something like this $res=mysql_query(...) eval($row_from_query); If you want to change the name of the array you could use eval(str_replace("$array","$newarray",$row_from_query)); HTH Dobromir Velev -----Original Message----- From: brendan <brendan.gogarty@utas.edu.au> To: php-db@lists.php.net <php-db@lists.php.net> Date: Thursday, September 13, 2001 2:20 PM Subject: [PHP-DB] array in db field -> actual array
hi, i am currently scouring the web for a solution to this but thought i would try here as well .. i have a text field in a mysql database the textfield contains an array written out as //-------------------- $array[0][1]="one"; $array[0][2]="two"; $array[0][3]="thre"; $array[1][1]="four"; $array[2][1]="five"; //-------------------- now i need to extract this from the db .. simple and use it as an array for a function .. not as simple as i thought it would be ie $newarray =mysqlquery('etc','etc','etc') and $newarray should be $newarray[0][1]="one"; $newarray[0][2]="two"; $newarray[0][3]="thre"; $newarray[1][1]="four"; $newarray[2][1]="five"; elp? cheers brendan -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-db-unsubscribe@lists.php.net For additional commands, e-mail: php-db-help@lists.php.net To contact the list administrators, e-mail: php-list-admin@lists.php.net


« previous php.db (#12403) next »