This has been resolved thanks to raina77ow. The from and to were messing the prepared statement up.
I have looked over this for the past 6 hours and I can not get this parametrized statement to work. However i have other parametrized statements that are working which look exactly like this. I know there is something wrong with my prepared statement but I cant seem to find the error. Can someone with a pair of fresh eyes help me?
function insert_event($post_id, $title, $location, $from, $to, $description)
{
//open connection to database
$mysqli = db_connect();
//insert
$stmt = $mysqli->prepare("INSERT INTO Events (".
"postID, ".
"title, ".
"location, ".
"from, ".
"to, ".
"description) ".
"VALUES (".
"'$post_id', ".
"?, ".
"?, ".
"?, ".
"?, ".
"?)");
$stmt->bind_param("sssss", $title, $location, $from, $to, $description);
$stmt->execute();
$stmt->close();
// close connection
$mysqli->close();
}
I have even tried this
$stmt = $mysqli->prepare("INSERT INTO Events (postID, title, location, from, to, description) VALUES ($post_id, ?, ?, ?, ?, ?)");
sorry if its so easy to see whats wrong