RE: [PHP] An if question
| From: | Rory McKinley | Date: | Tue, 04 May 2004 09:19:55 +0000 |
| Subject: | RE: [PHP] An if question | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-185283@lists.php.net to get a copy of this message | ||
On 4 May 2004 at 11:03, Ian Barnes wrote:
> Hi,
>
> Nope that doesnt work. Allows everything to be added. I tried adding 0, 6,1
> all are allowed
>
<snip>
Could it perhaps be that the if statement is viewing the 0 as false?
Try setting your $rec to a default value before the if statement e.g.
(!$rec?$rec=False:$rec=$rec)
if($rec === False || $rec > 5)
blah blah blah...
HTH
====================
Rory McKinley
Nebula Solutions
+27 21 555 3227 - office
+27 21 551 0676 - fax
+27 82 857 2391 - mobile
www.nebula.co.za
====================