Re: MySQL and PHP arrays

From: Date: Mon, 10 Mar 2003 16:44:53 +0000
Subject: Re: MySQL and PHP arrays
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-138973@lists.php.net to get a copy of this message
You get at the data through $array = mysql_result($result,0,0); Mike "{R}Ichard Ashton" <phpgeneral@semolina.org> wrote in message news:SMLN4576385DFD@semolina.org... > 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 > > > >

« previous php.general (#138973) next »