Help with unserialize array()
Moderator: General Moderators
Re: Help with unserialize array()
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
Above is what the values look like in the DB
Re: Help with unserialize array()
Aceconcept,
My code is as above in previous message, nothing fancy, just need it to work.
See my code above.
thanks Dave
My code is as above in previous message, nothing fancy, just need it to work.
See my code above.
thanks Dave
- mattcooper
- Forum Contributor
- Posts: 210
- Joined: Thu Mar 17, 2005 5:51 am
- Location: London, UK
Re: Help with unserialize array()
The serialized data you've posted here does not unserialize - it appears to be corrupt. Can you please re-post, providing:
Yours looks like this:
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 
- - 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
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";}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;- John Cartwright
- Site Admin
- Posts: 11470
- Joined: Tue Dec 23, 2003 2:10 am
- Location: Toronto
- Contact:
Re: Help with unserialize array()
The serialized values are still being truncated. Compare the format your showing us to this:
Where is the code inserting the contents of the database? Can you post your table structure?
EDIT | Beaten to it
Code: Select all
echo serialize(array('foo' => 'bar'));EDIT | Beaten to it
Re: Help with unserialize array()
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.
Now here is the PHP code that I inputted these data into the database:
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.
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>
Code: Select all
<?
include ("Conn.php");
$box=serialize($_POST['box']);
$insert = "INSERT INTO Exhibitors (Exh_Type)
VALUES ('$box')";
mysql_query($insert);
?>
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.
- John Cartwright
- Site Admin
- Posts: 11470
- Joined: Tue Dec 23, 2003 2:10 am
- Location: Toronto
- Contact:
Re: Help with unserialize array()
I meant what does show?
Code: Select all
SHOW CREATE TABLE Exhibitors- mattcooper
- Forum Contributor
- Posts: 210
- Joined: Thu Mar 17, 2005 5:51 am
- Location: London, UK
Re: Help with unserialize array()
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.
Code: Select all
serialize($_POST['box'])