MySQL and Array Problem
| From: | Jerry Lake | Date: | Wed, 17 Jan 2001 18:42:33 +0000 |
| Subject: | MySQL and Array Problem | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-35103@lists.php.net to get a copy of this message | ||
I'm trying to store an array into a MySQL
table, what datatype should the column be, Varchar?
second this is the code I use to store it.
mysql_connect("$DBHost","$DBUser","$DBPass");
$name = implode(",", $name);
mysql("$DBName","INSERT INTO CartItems VALUES
('$UID','$ItemID','$ItemQuantity','$all_toppings','$Date','$CartItemsID')");
this works fine, it stores the comma delimited info
into the table. however when I extract it and try to count($name)
it comes back as 1 and if I try to implode it it says Warning
bad argument to implode() and if I do this
echo "<font size=-2>".$name."</font>";
$name_test = explode("," $name);
echo $name_test;
the names item1,item2,item3 is returned,
but I get a parse error on the explode,
what am I missing...?
Jerry Lake