it is already a few days that I am looking for this to know :
How can I transfer a serialize array to a database in PDO ?
My data bases:
id | name | surname
public function save($value2, $value3)
$array = array('id' => '', ‘name’ => "$value2", ‘surname’ => "$value3");
$serialize = serialize($array);
mysqli_query("INSERT INTO mytable VALUES(NULL, 'serialize', '".mysqli_real_escape_string($serialize)."')") or die(mysqli_error());
Since you’re supposed to be using PDO, you should finish the job that way. While you’re there use pepared statements which will handle all of the tricky parts, such as strings which break SQL.
Assuming that you already have a PDO object
$pdo, this gives you:
$prepared=$pdo->prepare('INSERT INTO mytable VALUES(NULL,?,?)'); $prepared->execute(array('serialize',$serialize));
You can also use prepared statements if you’re using