On Tuesday 28 December 2004 23:43, GH wrote: > During the code... it gets to the following point... > > [snip] > ############################################# > # Check if report report is present or not # > ############################################# > if(!mysql_num_rows($dba['results']['attendance_report'])){ > #report is not present > return 0; > } > else { > #report is present > return 1; > #gets here > } > [/snip] > > it gets to the return 1 section.... Just to be sure, how are you determining that your code does indeed goes to the 'else' branch and return 1? Because if it does indeed return 1 then: echo isAttendanceReport(1); // should display 1 For debugging something like this I would put in echo statements (or trigger_error()) all over the place to indicate which part of the code is being executed. > however the calling statement just does not seem to work.... If isAttendanceReport() did indeed return 1 then the if-clause in displayMenu() would be obviously be true and would obviously execute (unless you have uncovered a bug in PHP). So the most likely explanation is that isAttendanceReport() is NOT returning 1. > using SID = 1, mysql_num_rows($dba['results']['attendance_report']) > evaluates to 8 > > Dunno if that helps.... How does $dba['results']['attendance_report'] get assigned? What variables does it rely on? What variables are present/not present in the case that succeeds/fails? > > Isolate the problem, just run isAttendanceReport() on its own and plugin > > various values to see what comes back. > > How can I do that... I have tried but how do you see what the output > is? I have tried just echo ing it, print_r, var_dump ... By not running unnecessary code. In this case you seemed to have determined that isAttendanceReport() is not returning what you think it should be returning. Hence running displayMenu() to test for the return value of isAttendanceReport() is unnecessary, particularly when the execution of displayMenu() is itself subject to a switch construct. So cut through the crap and just run isAttendanceReport() direct as in: echo isAttendanceReport(SOME_VALUE_FOR_SID); If you still don't get any joy then dig deeper. What isAttendanceReport() returns is solely dependent on: mysql_num_rows($dba['results']['attendance_report']) As I have hinted above you have to find out what code is setting $dba['results']['attendance_report'], what factors (variables) will affect that code, and even try running that bit of code direct instead of going through isAttendanceReport() (which itself is adding another layer of unnecessary complexity). -- Jason Wong -> Gremlins Associates -> www.gremlins.biz Open Source Software Systems Integrators * Web Design & Hosting * Internet & Intranet Applications Development * ------------------------------------------ Search the list archives before you post http://marc.theaimsgroup.com/?l=php-general ------------------------------------------ /* You are wise, witty, and wonderful, but you spend too much time reading this sort of trash. */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php