I have a form with several fields including some date fields. The date fields are defined in my Mysql database as datatype date. When I perform my insert statement and no dates have been entered into the field the database is getting loaded with defaults of 0000-00-00. If I peform the insert using my phpmyadmin connection it leaves the dates as NULL, which is what I prefer, because when the user now access another page with these dates they see the 0000-00-00. Here is my code for reference.
Code: Select all
$query = "INSERT INTO orders (id, orderid, name,vendor_name,descr,ordertype_code,status_code,dateordered,daterequired,shipvia_code,shipto_code,paymentterms_code,login_username)
VALUES ('', '$orderid', '$name', '$vendor_name', '$descr', '$ordertype_code', '$status_code', '$dateordered', '$daterequired', '$shipvia_code', '$shipto_code', '$paymentterms_code', '$login_username')";
$results = mysql_query($query);