My dates in mysql database are setting to 1999-11-30 no matter what I enter from my php form.
$degree_date = date("Y-m-d", mktime(0,0,0,$dt,$mo,$yr));
$other_degree_date = date("Y-m-d", mktime(0,0,0,$dty,$moy,$yry));
$expd_degree_date = date("Y-m-d", mktime(0,0,0,$dti,$moi,$yri));
Examples:
1. Date of Award
<select input name="dt" type="text" id="dt">
<select input name="mo" type="text" id="mo">
<select input name="yr" type="text" id="yr">
2. Date of Award
<select input name="dty" type="text" id="dty">
<select input name="moy" type="text" id="moy">
<select input name="yry" type="text" id="yry">
3. Date of Award
<select input name="dti" type="text" id="dti">
<select input name="moi" type="text" id="moi">
<select input name="yri" type="text" id="yri">
Insert statement:
$sql_insert = "INSERT into `acadmic`
`degree_date`,`other_degree_date`, `expd_degree_date`
)
VALUES
'$degree_date', '$other_degree_date','$expd_degree_date',
I am getting messages that $dt $mo $yr etc aren’t defined
Any help?
A google search for “‘1999-11-30’ mysql php” came up with a non-bug on the first hit to explain why “1999-11-30” could be your result:
I tested
echo date("Y-m-d", mktime(0,0,0,0,0,0))and that does print out1999-11-30as described in the reported PHP bug.You may want to investigate whether your variables ($dt,$mo,$yr) actually have the correct values set from the form to begin with.