View Single Post
  #5 (permalink)  
Old 08-31-2004, 07:38 PM
php~pro php~pro is offline
WebProWorld Pro
 
Join Date: May 2004
Location: United Kingdom
Posts: 151
php~pro RepRank 0
Default

Code:
/Connect to db

//Handle form

//define the date
$order_date=".$year."-".$month."-".$day."; 
//Define query
$query1 = "INSERT INTO orders (order_date) VALUES ( '$order_date' )";
NOT
Code:
$query1 = "INSERT INTO orders (order_date) VALUES ('{$_POST['order_date']}')";
Because in your code you were trying to enter a value from a $_POST['variable']. In the snippet above the value is made up into a single variable $order_date. Replace your posted code with the code inserted above. It works well. Tested. It will also work in date, date(13), or varchar. MySQL is easy going on date inputs to a date formatted column, ie even if the value you inserted was 2004/09/06 the entered value would be 2004-09-06. Same applies for many other +,\, _, ~
Reply With Quote