Click here to Skip to main content
15,947,057 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
why is the date inserted as 0000-00-00 in my sql .
i know that the format of data in mysql is yyyy-mm-dd
i changed the date format which i would like to insert in mysql using below code
PHP
$date=$_POST['date'];
$date=date('Y-m-d',strtotime($date));

also i make sure that it is right after i print it
echo $date ;


when i test this code in the browsers it display 2013-07-02 while in phpmyadmin it still the same
0000-00-00

so kindly clarify please , thanks
Posted
Updated 29-Jun-22 18:54pm

1 solution

solved , it is my mistake , in insert command i forget to write single quote
but now it is ok . thanks

SQL
$query="insert into attend(attend_date,son_id,attend_type)
values('$att_date',$att_sonid,$att_type)";
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900