[thelist] is_null php

Paul Bennett paul at teltest.com
Tue Jul 29 21:08:26 CDT 2003


>select...UNIX_TIMESTAMP(eventEnd) as unixtimeEnd
>
>// row results
>$unixTimeEnd = $queryResult["unixtimeEnd"];
>$eDateEnd = date("M j, Y", $unixTimeEnd);
>
Ah hah! If the query result is empty, then eDateEnd will always be "Jan 
1,1970" as the date() function will return the default first date range 
from the timestamp option if the (optional) timestamp value you pass it 
is empty or not a valid timestamp, thus in this case there will NEVER be 
a NULL value in $eDateEnd.
Check $unixTimeEnd for a null value, not $eDateEnd
(or if you don't want ot use is_null you can use:

if(strlen(trim($unixTimeEnd)) != 0)
    {
    # print stuff here
    }


-- 
 ------------------------------
	Paul Bennett						
	Internet Developer				
	Teltest Electronic Design		
 ------------------------------			
Email: paul at teltest.com				
Phone: 64 4 237 4557					
Web: http://www.teltest.com		
Wap: http://wap.teltest.com			




More information about the thelist mailing list