Possible Duplicate:
How to store an array into mysql?
This is an array that i need to store in databse:-
$v=array(
"Image"=> array (
0=> array (
"id"=> 150,
"Tags"=> array(
0=> array ( "id"=> 200, "text"=>"John Doe", "left"=> 250, "top"=> 50, "url"=> "person.php?id=200" ,"isDeleteEnable"=> true ),
1=> array ( "id"=> 400, "text"=> "Michael Smith", "left"=> 420, "top"=> 45, "width"=> 120, "height"=> 120, "isDeleteEnable"=> true ),
2=> array ( "id"=> 500, "text"=> "Peter Parker" ,"left"=> 55 ,"top"=> 40, "url"=> "person.php?id=500" ,"isDeleteEnable"=> false )
)
)
)
) ;
Is there any function which can do this, so that this whole array can be stored in database.
I am developing on LAMP.
Also i need retrieve this array again from database.
Have a look at
serialize()And, of course,
unserialize()to restore it.Working Demo (using the data you’ve provided)