Hi Php'ers,
I'm new to Php.
I have some issues INSERTING date to MySQL by PHP.
here's my code snippet:
//date format
$date1 = mysqli_real_escape_string($_POST['j_avail']);
$d1 = date('Y-m-d',($date1));
$date2 = mysqli_real_escape_string($_POST['j_expir']);
$d2 = date('Y-m-d',($date2));
the query:
$sql = "INSERT INTO table (....,j_avail,j_expir)
VALUES (....,'$d1','$d2')";
the HTML:
<td id="ititle">Availability :</td>
<td><input type="date" name="avail" id="datep"></td>
</tr>
<tr>
<td id="ititle">Expiration :</td>
<td><input type="date" name="exp" id="datep"></td>
</tr>
When i execute my the code and check my db i get this 1970-01-01.
i also have tried strtotime it also gives me this result.
Dont know whats the issue here. hmmmm
Thanks.
OTEP