On Mon, 10 Mar 2003 22:34:44 +0800, Jason Wong wrote: >On Monday 10 March 2003 22:30, {R}ichard Ashton wrote: >> Is there a generally recommended way of storing an array created by PHP >> in a MySQL database field ? > >serialize() and unserialize(). > >> What type of field should it be, and how do you get the whole array >> back in one go without reconstructing it row by row, if that is >> possible? > >Any text field will do, just make sure it's large enough for your data.
Thanks that now makes much more sense. So when I look at the data in the database I see a:142:{i:1;s:52:[52characters];i:2;s:37:[37characters] and so on for the 142 elements of the array. But getting it out is not so easy. $result = mysql_query( " select post from posts where id = '$id' ") Gives $result as a Resource id #6 which is OK but I cant find the PHP MySQL command to get the whole field back to unserialize it :( {R} >-- >Jason Wong -> Gremlins Associates -> www.gremlins.biz >Open Source Software Systems Integrators >* Web Design & Hosting * Internet & Intranet Applications Development * >------------------------------------------ >Search the list archives before you post >http://marc.theaimsgroup.com/?l=php-general >------------------------------------------ >/* >QOTD: > I'm not bald -- I'm "hair challenged". > > [I thought that was "differently haired". Ed.] >*/ > > >-- >PHP General Mailing List (http://www.php.net/) >To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php