Tags
Sometime we need to store array to database then we need to retrieve and use as variable array. I used session variable to save data and used it later.
Its simple just use the following
#using serialize() method $data = serialize($_SESSION); $sql = "Insert into sessioninfo `data` values('$data')";
just run the above query and save the whole session data into a database table. You might be use any array here.
Now retrieve the data
# I assume you can retrieve the data from database and assign to the following variable $data = unserialize($row['data']);
Now $data have the same value or nested array.
So just using serialize() and unserialize() we can do this.
Done !