$con = mysqli_connect('localhost','root','',"z_db_test");
$tablename = 'test';
$about = 'Some info';
$firstname = 'Doe';
$lastname = 'Joe';
$datas = array('about'=>$about,'firstname'=>$firstname,'lastname'=>$lastname);
function addeverything($tablename,$datas)
{
$keys= array_keys($datas);
$insert = "INSERT INTO ".$tablename."
('`'.implode('`,`', $keys).'`')
VALUES(" '
".implode("
','
", $datas)."
'
") ";
return mysqli_query($insert);
}
addeverything('test',array('about'=>$about,'firstname'=>$firstname,'lastname'=>$lastname));
So i get the error
Parse error: syntax error, unexpected ''".implode("'' (T_CONSTANT_ENCAPSED_STRING) in C:\xampp\htdocs\test\index.php on line 20
How to fix the error?