Re: Storing an array in the database

From: Date: Fri, 28 Feb 2003 16:28:19 +0000
Subject: Re: Storing an array in the database
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-26000@lists.php.net to get a copy of this message
just as a quick fix. I use the following snip to take an array of choices, enter it into a varchar field (or text if you expect alot) and extract back to array: $choicesArray is a list of checkboxes from a form // put data into table $checkList = implode(";", $choicesArray); mysql_query("update table set choices='$checkList' where id=$itemID"); ... // get data out of table mysql_query("select choices from table where id=$itemID"); $choiceArray=explode(";",$row['choices']); // this is of course, rough and simplified, but you should get the idea. Terry On Friday, February 28, 2003, at 10:09 AM, Jonathan Villa wrote:
How would I store an array in the database? I want to store 2 things. One array of shirt sizes and one array of which holds other arrays.


« previous php.db (#26000) next »