I can’t only assign a date to the php variable from the datetime field of the MySQL table. I am using PHP 4 , I know how to do this in PHP 5.
Can someone help with what is missing in the PHP code below.
$dc = mysql_query("SELECT * FROM INVHDR WHERE Invdate BETWEEN '2011-04-01' AND '2012-03-31'"); while ($dc2 = mysql_fetch_assoc($dc)) { $invno = $dc2['Invno']; // Here Invno is a datetime field type $invdat3 = $dc2['Invdate']; $date_array = explode("-", $invdat3); $invdat = sprintf('%02d/%02d/%4d', $date_array[2], $date_array[1], $date_array[0]); }
source share