Re: not gettingg desired results... is my programming logic run amuck...

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Ok here is what I get... 

> >The isAttendanceReport() fails... so in the displayMenu() function I get
> >
> > Print Attendance Sheet
> > No Attendance Report Available1
> 
> OK, so why does isAttendanceReport() return 0?
> 
> When debugging it's always a good idea to plugin absolute values where
> possible, ie instead of using isAttendanceReport($SID), use
> isAttendanceReport(1).

    When using 1 in the fuction... no change.... 

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....
however the calling statement just does not seem to work....

using SID = 1, mysql_num_rows($dba['results']['attendance_report'])
evaluates to 8

Dunno if that helps....

> 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 ...

> 
> > > Note that it is good practice to use { } around your statement(s).
> >
> > I am under the opression that it is only for when you have
> > multistatement groups and not just a one statement after a condition?
> > Please correct me if I am wrong.
> 
> You're not wrong, like I said it's _good practice_. Say you revise your code
> to add more statements, it is all too easy to forget to put in the braces as
> well thus resulting in faulty logic in your code and you pulling your hair
> out trying to figure what the problem is. PHP's flexibility also means that
> there is more than one way to shoot yourself in the foot (TIMTOWTSYITF (TM)).
> 
> BTW PHP is not an oppressive language at all :)
> 
> --
> 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
> ------------------------------------------
> /*
> The wind doth taste so bitter sweet,
>  Like Jaspar wine and sugar,
> It must have blown through someone's feet,
>  Like those of Caspar Weinberger.
>   -- P. Opus
> */
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
>

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux