Date Problems
Posted: Wed May 14, 2008 7:03 am
I want to insert current date and due date for the invoices in the database.
I have tried alot but didn't get any fruitful result.
I am providing the user with due_date field and the current date should insert automatically with the record.
The datatypes of the current_date and the due_date both are DATE.
I want to clear one more thing, should i specify the date format to the user to use?
I don't know what to write for the due_date in the query.
Please help.
I have tried alot but didn't get any fruitful result.
I am providing the user with due_date field and the current date should insert automatically with the record.
The datatypes of the current_date and the due_date both are DATE.
I want to clear one more thing, should i specify the date format to the user to use?
Code: Select all
$c_date=date("Y-m-d");
$d_date='$_post[due_date]'; //just putting value from text box
$sql= "INSERT INTO invoices SET client_id='{$_POST['c_id']}', service_name='{$_POST['s_name']}',
service_description='{$_POST['s_desc']}', comments='{$_POST['comments']}', init_price='{$_POST['i_price']}',
price='{$_POST['price']}', adjustments='{$_POST['adj']}', total_price='{$_POST['t_price']}',
current_date='$date' , due_date='{$_POST['d_date']}' "; Please help.