Re: Storing an array in the database

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

 



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.

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


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux