Forms php & mysql

You could use serialize/unserialize.

PHP:
// Store this in the database
$data = serialize($_POST);

// Retrieve $data from the database and decode it back to an array
$decoded = unserialize($data);
// Show the contents of the array
var_dump($decoded);
 
Thats what i needed to know, but can anyone tell me why this one work ?

Code:
foreach($result as $key => $value) {
                $keys = unserialize($key);
                $values = unserialize($value);
                
                print_r($keys);
                print_r($values);
                $output[$keys] = $values;
            }

the print_r is purely for testing, but the actual print_r($values) is empty even though it shouldnt be
 
Hmm.. assuming $result is a single row from the database and $result = mysql_fetch_row() then maybe:
PHP:
$post = unserialize($result);
foreach($post as $key => $value) {
       echo "$key => $value<br/>";
}
 
Last edited:
Back
Top Bottom