Skip to content

Instantly share code, notes, and snippets.

@henrikbjorn
Created March 3, 2009 10:19
Show Gist options
  • Save henrikbjorn/73268 to your computer and use it in GitHub Desktop.
Save henrikbjorn/73268 to your computer and use it in GitHub Desktop.
<?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