Re: saving and retrieving an array from a database
| From: | Colin Guthrie | Date: | Mon, 07 Aug 2006 14:16:06 +0000 |
| Subject: | Re: saving and retrieving an array from a database | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-240251@lists.php.net to get a copy of this message | ||
ross@aztechost.com wrote:
ok this seem to work but how do I bring it back? This is what I have so far. <? $first[] = array('appple', 'pear', 'banana'); $second = serialize($first); $third[]= unserialize($second); echo $second; //outputs serialized data echo $third[1]; ?>I think you misunderstand how arrays work (at least in your example) I think you really meant to try something like this: <? $first = array('appple', 'pear', 'banana'); $second = serialize($first); $third= unserialize($second); // $first == $third; var_dump($first); var_dump($third); echo $first[1]; // pear echo $third[1]; // pear ?>