Jump to content

[SOLVED] Date Format Problem


vinoindiamca

Recommended Posts

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

Link to comment
https://forums.phpfreaks.com/topic/137807-solved-date-format-problem/
Share on other sites

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 ?

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

 

[/]

[][/]

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.