I can’t figure this out. This query inserts a new record with all the fields as needed but for whatever reason, it gives me a 500 server error after the insertion returning neither true or false:
$connection = Database::getConnection();
$query = "INSERT INTO reviews
VALUES ('0', (SELECT tbl_id FROM table WHERE brand = '$brand' AND model = '$model'),
(SELECT user_id FROM users WHERE user_name = '$user'), '$overall', '$lvalue',
'$pvalue', '$dvalue', '$vvalue', '$summary',
'$review', '$date')";
$result = $connection -> query($query);
if (!$result || $result -> affected_rows < 1) {
$result -> close();
return FALSE;
} else {
$result -> close();
return TRUE;
}
Any help is GREATLY appreciated!
$resultcontains a instance ofmysqli_resultwhich DOES NOT have aclose()method.If you want to close the connection, it should be
see: http://www.php.net/manual/en/class.mysqli-result.php