Date Test...

From: Date: Wed, 07 Jul 2010 20:28:57 +0000
Subject: Date Test...
Groups: php.general 
Request: Send a blank email to php-general+get-306739@lists.php.net to get a copy of this message
Hello all, I am processing an array to build an INSERT string in PHP. The code below I build an a separate array for the TARGET fields and the VALUES. I am trying to trap for a NULL ENTRY in a Date Input Field. Date fields are identified with: $ffield['s']=='/' I tried to add the "&& !empty($fval)" to the test but it is giving my an unexpected results. In my case, I have a Data of Birth field that keeps populating in the future: So 1941-06-16 inserts in the DB as 2041-06-16. foreach($form_fields as $ffield){ $fval = is_array($ffield['f'])?joinFields($ffield['s'],$ffield['f']):$_POST[$ffield['f']]; $query_values[] = "'".mysql_real_escape_string($ffield['s']=='/' && !empty($fval) ?date('y-m-d',strtotime($fval)):$fval)."'"; } Will anyone point out the problem with this CODE? Don Wieland

« previous php.general (#306739) next »