Page 2 of 2
Re: Help with unserialize array()
Posted: Wed Apr 23, 2008 11:15 am
by dv_evan
Arraya:2:{i:0;sa:3:{i:0;sa:3:{i:0;sN;N;N;N;N;N;N;N;N;N;
Above is what the values look like in the DB
Re: Help with unserialize array()
Posted: Wed Apr 23, 2008 11:18 am
by dv_evan
Aceconcept,
My code is as above in previous message, nothing fancy, just need it to work.
See my code above.
thanks Dave
Re: Help with unserialize array()
Posted: Wed Apr 23, 2008 11:24 am
by mattcooper
The serialized data you've posted here does not unserialize - it appears to be corrupt. Can you please re-post, providing:
- - A text echo of the array
- The raw serialized array string you're storing
- The string as returned by your query
- The properties of the field you are storing this in
A correctly serialized array should look like this:
Code: Select all
a:7:{i:0;s:4:"Page";i:1;s:4:"User";i:2;s:10:"PageModule";i:3;s:4:"News";i:4;s:8:"Location";i:5;s:7:"Content";i:6;s:12:"UserLocation";}
Yours looks like this:
Code: Select all
Arraya:2:{i:0;sa:3:{i:0;sa:3:{i:0;sN;N;N;N;N;N;N;N;N;N;
When you post here, try to provide as much info as possible (from my experience in the early days!) for us to help you debug

Re: Help with unserialize array()
Posted: Wed Apr 23, 2008 11:25 am
by John Cartwright
The serialized values are still being truncated. Compare the format your showing us to this:
Code: Select all
echo serialize(array('foo' => 'bar'));
Where is the code inserting the contents of the database? Can you post your table structure?
EDIT | Beaten to it

Re: Help with unserialize array()
Posted: Wed Apr 23, 2008 11:44 am
by dv_evan
Thanks Again,
Sorry if I am confusing you all more than I am helping myself.
Ok from Start, here is the HTML form that will collect the checkbox data.
Code: Select all
<form action='".$_SERVER['php_self']."' method='post'>
<td width='25%'><input type=checkbox name=box[] value='Mathew'></td>
<td width='25%'> Mathew</td>
<td width='25%'><input type=checkbox name=box[] value='Reid'></td>
<td width='25%'> Reid</td>
<td width='25%'><input type=checkbox name=box[] value='Simon'></td>
<td width='25%'> Simon</td>
<tr><th colspan=2><input type='submit' name='submit' value='Register'></th></tr>
</form>
Now here is the PHP code that I inputted these data into the database:
Code: Select all
<?
include ("Conn.php");
$box=serialize($_POST['box']);
$insert = "INSERT INTO Exhibitors (Exh_Type)
VALUES ('$box')";
mysql_query($insert);
?>
All I need is to output this in a readable form.
Database info:
TableName: Exhibitors
FieldName: Exh_Type
DataType: Well you guys had ask for me to change to 'TEXT'
Let me know if you need any other information for you to assist me.
Dave.
Re: Help with unserialize array()
Posted: Wed Apr 23, 2008 11:51 am
by John Cartwright
Re: Help with unserialize array()
Posted: Wed Apr 23, 2008 11:58 am
by mattcooper
I'll say again: if you can post the data from
And the data that comes back from your query, they can be compared... therein lies your problem I think.