Re: saving and retrieving an array from a database

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



ross@xxxxxxxxxxxxx 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


?>

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux