Re: storing array in mysql

From: Date: Tue, 31 Jul 2001 11:04:57 +0000
Subject: Re: storing array in mysql
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-60376@lists.php.net to get a copy of this message
when you submit this form, PHP will give a array variable called $name you can store in in MySql as: <? // will make the $name as a comma seperated string $str = join(",", $name); insert into tablename(id, value) VALUES(null, '$str'); ?> now to reget the array, you can select it back from MySql and split it as: <? $name = split(",", $str); ?> //elias "Matthew Delmarter" <matt@adplusonline.com> wrote in message news:NDBBKBIHLCDMDICHLDKGIECOCGAA.matt@adplusonline.com... > Hi all, > > I want to store the results of a multiple select input box in a mysql > db. The box looks like this: > <select name='name[]' size='5' multiple> > <option value='id'>name</option> > </select> > > I cannot seem to store the array in a database and then output the > result using foreach. Any tips? > > Regards, > > Matthew Delmarter > Web Developer > > AdplusOnline.com Ltd > www.adplusonline.com > > Phone: 06 8357684 > Cell: 025 2303630 >

« previous php.general (#60376) next »