Fatal error: Call to a member function on a non-object

A

Anonymous

Guest
Hi to all

I am having problem with this error message, while trying to do a print "test"; this error msg came out to show that this fatal error was due to $Class_ID = $rsTimetable->Fields("Class_ID"); , i am wondering what is wrong with it, cos initially everything was working fine. Do note that there is no problem with the function GetTimetable(); i also did to check if $rsTimetable is a object, it turns out false. Also before this i had encountered a bad server request, saying about cookies and a header file, could that have something to do with this? Please advise.

$rsTimetable = GetTimetable($DayOfWeek_ID, $Branch_ID);

$db->debug = false;
if ($rsTimetable)
print "test"
while (!$rsTimetable->EOF) {

$Class_ID = $rsTimetable->Fields("Class_ID");

print("<tr>");
print("<td>".$rsTimetable->Fields("fTimeStart")." - ".$rsTimetable->Fields("fTimeEnd")."</td>");
print("<td>".GetEducationLevelDescription($rsTimetable->Fields("Class_EducationLevel_ID"))."</td>");
print("<td><a href=\"javascript:class_student($Branch_ID,$Class_ID,$DayOfWeek_ID)\">".$rsTimetable->Fields("Class_Code")."</a></td>");
//print("<td><a href=\"#\">".$rsTimetable->Fields("Class_Code")."</a></td>");
print("<td>".ReplaceCRLF($rsTimetable->Fields("Class_Description"), '<br>')."</td>");
print("<td>".GetTotalStudents($Class_ID)."</td>");
print("<td><a href=\"javascript:student_registration($Branch_ID,$DayOfWeek_ID,$Class_ID)\">Add Student</a></td>");
print("<td>".$rsTimetable->Fields("Tutor_Name")."</td>");
print("<td><a href=\"javascript:class_attendance_list($Branch_ID,$Class_ID)\">Print</a></td>");
print("</tr>");
$rsTimetable->MoveNext();
}
 
This would seem to be a problem with the GetTimetable funciton or how it's being called; it isn't returning an object. Here's a couple suggestions: First, turn error_reporting to E_ALL. Always use this setting in your development environment. Second, try print_r on $rsTimetable to see what its value is.
 
Hi,

Thanks for your help. I had already solved the problem, it was something to do with my GetTimetable().
 
Back
Top