RE: Re: NULLS vs Empty result in PHP

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

 



On Wed, 2009-09-23 at 16:34 +0300, Mert Oztekin wrote:
> if it can take only numeric values u can use is_numeric()
> 
> also i suggest that you not to use nulls in dbs. instead, use "not null" and "default value" property. Its more simple and more effective for both managing your database and coding your program.
> 
> 
> -----Original Message-----
> From: Robert Cummings [mailto:robert@xxxxxxxxxxxxx]
> Sent: Wednesday, September 23, 2009 4:28 PM
> To: Ralph Deffke
> Cc: php-general@xxxxxxxxxxxxx
> Subject: Re:  Re: NULLS vs Empty result in PHP
> 
> Ralph Deffke wrote:
> > using empty() is ´the right way to check a var for NULL or ""
> 
> Empty will also match a string containing 0. And, to me, that doesn't at
> all seem empty :)
> 
> Cheers,
> Rob.
> --
> http://www.interjinn.com
> Application and Templating Framework for PHP
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 
> 
>   ________________________________
> Bu mesaj ve ekleri, mesajda gönderildiği belirtilen kişi/kişilere özeldir ve gizlidir. Size yanlışlıkla ulaşmışsa lütfen gönderen kisiyi bilgilendiriniz ve mesajı sisteminizden siliniz. Mesaj ve eklerinin içeriği ile ilgili olarak şirketimizin herhangi bir hukuki sorumluluğu bulunmamaktadır. Şirketimiz mesajın ve bilgilerinin size değişikliğe uğrayarak veya geç ulaşmasından, bütünlüğünün ve gizliliğinin korunamamasından, virüs içermesinden ve bilgisayar sisteminize verebileceği herhangi bir zarardan sorumlu tutulamaz.
> 
> This message and attachments are confidential and intended for the individual(s) stated in this message. If you received this message in error, please immediately notify the sender and delete it from your system. Our company has no legal responsibility for the contents of the message and its attachments. Our company shall have no liability for any changes or late receiving, loss of integrity and confidentiality, viruses and any damages caused in anyway to your computer system.

Or you could leave the database with the nulls in, and cast the value
explicitly as an integer with intval() or floatval() which will always
give you a numeric value.

Thanks,
Ash
http://www.ashleysheridan.co.uk




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