Hi everyone, first time here and I hope you can help me. I'm just starting with php and I have a problem. I get an error back from my browser when I load a page, which worked perfectly before,:
"Database query failed: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1"
When adding this bit of code:
I've been over it and over it but I can't figure out what I'm doing wrong. Any help would be apreciated.PHP Code:function get_subject_by_id($subject_id) {
global $connection;
$query = "SELECT * ";
$query .= "FROM subjects ";
$query .= "WHERE id = {$subject_id}";
//$query .= "LIMIT 1";
$subject_set = mysql_query($query, $connection);
confirm_query($subject_set);
//if no rows are returned, then fetch_array will return false
if ($subject = mysql_fetch_array($subject_set)) {
return $subject;
}else{
return NULL;
}
}


Reply With Quote
Bookmarks