higher number check fails
I'm kinda puzzled by this..
- I retrieve a value of a db field and store it into the variable $numbers.
- I count the number of records in an other database table and store that value in $num_rows.
If the value in $num_rows is higher then $numbers the user gets a warning.
My problem is that the warning is allways displayed even if the value of $num_rows is lower then $numbers.
For example, the coding below displays this:
test email@example.com reached.
($num_rows is 1, and $numbers is 5 in this case)
Obviously the higher number check fails, since $num_rows is less then $numbers. How to solve this issue?
From your echo statement it's possible $num_rows is = 15 and $numbers is null. Since we can't see where $numbers got assigned a value I'd say this may be what's happening. If you wrote your echo statement a bit more clearly then you might see what's really going on-- obviously 1 is not greater than 5 and PHP knows that :p
Try using var_dump() on the two variables-- that will tell you if the variable types are numeric or strings.
See what this does:
just wondering if it's an issue of syntax (or formation of the "if" statement) ...
|All times are GMT +1. The time now is 08:45 AM.|
Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.