I\'m editing a script that is using MySQLi. I need to use prepared statement to insert some values into the db.
My array is in the form of:
$insert =
I think this is what you are looking for:
cols = array_keys($insert);
$query = "INSERT INTO results (". implode(", ", $cols) .") VALUES (". str_repeat('?', count($insert)) .")";
$stmt = $mysqli->prepare($query);
call_user_func_array('mysqli_stmt_bind_param', array_merge (array($stmt, str_repeat('s', count($insert))), $insert);