at the moment i have the following code:
Code: Select all
$day = int ( stripslashes ( trim ( $_POST['day'] ) ) );
$month = int ( stripslashes (trim ( $_POST['month'] ) ) );
$year = int ( stripslashes ( trim ( $_POST['year'] ) ) );thanks
Moderator: General Moderators
Code: Select all
$day = int ( stripslashes ( trim ( $_POST['day'] ) ) );
$month = int ( stripslashes (trim ( $_POST['month'] ) ) );
$year = int ( stripslashes ( trim ( $_POST['year'] ) ) );Code: Select all
$date = $year."-".$month."-".$day;Code: Select all
$date = sprintf('%04d-%02d-%02d', (int)$year, (int)$month, (int)$day);Code: Select all
$date = date($year."-".$month."-".$day);Code: Select all
$date = $year."-".$month."-".$day;That's not going to work as expected. The date() function takes a timestamp and converts to a readable date format using parameters. You are taking a date from PHP, inserting to MySQL, then pulling it out and converting back to PHP? Why not change the default date format in your MySQL table so they are always the same?garry27 wrote:i still can't get mysql to recognise the date. i'm using:
Code: Select all
$date = date($year."-".$month."-".$day);