RE: [PHP] Re: NULLS vs Empty result in PHP
| From: | Ashley Sheridan | Date: | Wed, 23 Sep 2009 13:37:45 +0000 |
| Subject: | RE: [PHP] Re: NULLS vs Empty result in PHP | ||
| References: | 1 2 3 4 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-298276@lists.php.net to get a copy of this message | ||
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@interjinn.com]
> Sent: Wednesday, September 23, 2009 4:28 PM
> To: Ralph Deffke
> Cc: php-general@lists.php.net
> Subject: Re: [PHP] 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