Re: array in db field -> actual array
| From: | Dobromir Velev | Date: | Thu, 13 Sep 2001 11:25:05 +0000 |
| Subject: | Re: array in db field -> actual array | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-12401@lists.php.net to get a copy of this message | ||
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
>
>