Date Test...

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

 



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

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