function get_subject_by_id($subject_id){
global $connection;
$query = "SELECT * ";
$query .= "FROM subjects ";
$query .= "WHERE 'id' ={$subject_id} ";
$query .= "LIMIT 1 ";
$result_set = mysql_query($query, $connection);
confirm_query($result_set);
// if no rows are returned fetch_array will return false
if(!is_null($result_set)){
echo "got here";
echo $result_set;
}
if($subject=mysql_fetch_array($result_set)){ // not working properly
echo "testing fetch array";
return $subject;
}else {
return NULL;
}
The fetch query keeps returning false although I have 3 items in my table. Some of the code obviously is testing to see if I got result back and those all work but the fetch array isn't executing the if statement because it thinks that it is false. Please help a few hours of frustration belong to this problem