vinoindiamca Posted December 20, 2008 Share Posted December 20, 2008 Hi I need help yaar regarding date format in mysql $ardt=$_POST["txtardt"]; $drdt=$_POST["txtdrdt"]; $query="insert into booking values('$ardt','$drdt')"; mysql> select * from booking; +--------+-------+-------------+-------------+-------------+---------------+---- --------+----------+---------+---------+--------+---------+ ArrivalDate | DepartureDate --------+----------+---------+---------+--------+---------+ | 0000-00-00 | 0000-00-00 | | 0000-00-00 | 0000-00-00 | -------------+---------------+---- How to insert with date format Quote Link to comment https://forums.phpfreaks.com/topic/137807-solved-date-format-problem/ Share on other sites More sharing options...
MadTechie Posted December 20, 2008 Share Posted December 20, 2008 Wow lots of info to work on.. check the users are entering the date in the correct format.. or are you getting an error or sql injection problems or so you require some validation or are you just showing us what you have done for the sake of it? What is the current form input like ? Quote Link to comment https://forums.phpfreaks.com/topic/137807-solved-date-format-problem/#findComment-720267 Share on other sites More sharing options...
vinoindiamca Posted December 20, 2008 Author Share Posted December 20, 2008 Hi I need help yaar regarding date format in mysql $name=$_POST["txtname"]; $comp=$_POST["txtcomp"]; $addr=$_POST["txtaddr"]; $ardt=$_POST["txtardt"];$drdt=$_POST["txtdrdt"]; $typroom=$_POST["typroom"]; $bookby=$_POST["txtbookby"]; $phone=$_POST["txtphone"]; $email=$_POST["txtemail"]; $mobile=$_POST["txtmobile"]; $paysel=$_POST["txtpaysel"]; $query="insert into booking values(NULL,'$name','$comp','$addr',$ardt,$drdt,$typroom,'$bookby','$phone','$email','$mobile',$paysel)"; insert into booking values(NULL,'erter','tert','34534',12/12/2008,12/12/2008,1,'345','43543534','5435','43534',1) mysql> select * from booking; +--------+-------+-------------+-------------+-------------+---------------+---- --------+----------+----------+---------+--------+---------+ | bookid | Name | CompanyName | FullAddress | ArrivalDate | DepartureDate | Typ eofroom | Bookedby | PhoneNo | EmailId | Mobile | Payment | +--------+-------+-------------+-------------+-------------+---------------+---- --------+----------+----------+---------+--------+---------+ | 1 | dfsdf | sfsdfsdf | sdfs | 0000-00-00 | 0000-00-00 | 1 | 4353534 | 345345 | 535 | 5345 | 1 | | 2 | fsdf | sdfsdf | sdfsd | 0000-00-00 | 0000-00-00 | 1 | sdf | sdfds | fsdfsd | fsdfsd | 1 | | 3 | dsf | dsfdsf | sdfsdf | 0000-00-00 | 0000-00-00 | 2 | 23423 | 4234 | 24 | 32423 | 1 | | 4 | erter | tert | 34534 | 0000-00-00 | 0000-00-00 | 1 | 345 | 43543534 | 5435 | 43534 | 1 | | 5 | erter | tert | 34534 | 0000-00-00 | 0000-00-00 | 1 | 345 | 43543534 | 5435 | 43534 | 1 | +--------+-------+-------------+-------------+-------------+---------------+---- --------+----------+----------+---------+--------+---------+ 5 rows in set (0.00 sec) User Entering the date format like 12/12/2008 [/] [][/] Quote Link to comment https://forums.phpfreaks.com/topic/137807-solved-date-format-problem/#findComment-720270 Share on other sites More sharing options...
MadTechie Posted December 20, 2008 Share Posted December 20, 2008 insert into booking values(NULL,'erter','tert','34534','2008-12-12','2008-12-12',1,'345','43543534','5435','43534',1) see here Quote Link to comment https://forums.phpfreaks.com/topic/137807-solved-date-format-problem/#findComment-720272 Share on other sites More sharing options...
vinoindiamca Posted December 20, 2008 Author Share Posted December 20, 2008 Thanks a lot Quote Link to comment https://forums.phpfreaks.com/topic/137807-solved-date-format-problem/#findComment-720280 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.