Hi everyone,
I'm having trouble accessing a Mysql database containing checkbox data
that is posted from a form. I use the serialize function to store the
checkbox values in an array (in a column called "CHECKBOX").
Each row in the table has this format:
a:2:{i:0;s:7:"Peanuts";i:1;s:9:"Cows_milk";}
So I know the serialize function works fine. However, when using the
unserialize function to convert the data back into its single form. I
have no luck. The output for each row is "Array". Below is the code.
<?php //Code to connect to the database server
...
...
$query = "SELECT * FROM checkbox";
$doQuery = mysql_query($query);
$numrows = mysql_num_rows($doQuery);
if($numrows > 0)
{
while($checkbox = mysql_fetch_array($doQuery))
{
$check = unserialize($checkbox['CHECKBOX']);
echo($check);
}
}
?>
Can anyone offer any ideas about what I'm doing wrong?
Thanks in advance!
Bee.