Created
March 3, 2009 10:19
-
-
Save henrikbjorn/73268 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$array = array( | |
'key' => 'value', | |
'key2' => 'value', | |
); | |
//array as string | |
$string = serialize($array); | |
//do some save with string | |
//lets assume the field containing the serialized data is called vars | |
//get the stuff from db | |
$query = mysql_query(); | |
//loop over it | |
for ($row = mysql_fetch_array($query)) { | |
//make vars into an arrya again | |
$row['vars'] = unserialize($row['vars']); | |
//dummy print to see it works | |
print '<pre>' . print_r($row, true) . '</pre>'; | |
die; //just show one row :P | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment