I have a INSERT Statement I am working on:
$orderquery = mysql_query("INSERT INTO orders (date_created, customer_name, shipping_address, customer_email)
VALUES (NOW(), '$orderedby', '$completeaddy', '$email')");
$order_id = mysql_query("LAST_INSERT_ID()");
I am not going to make it a long post by putting it all up.
In my orders table I have the following:
Field--Type--Key--Extra
order_id int(11) unsigned PRI auto_increment
total_amount double(10,2)
date_created datetime
date_shipped datetime
verified tinyint(1)
completed tinyint(1)
canceled tinyint(1)
comments varchar(255)
customer_name varchar(50)
shipping_address varchar(255)
customer_email varchar(50)
shipping decimal(10,2)
that being said, I declare the value of the variables to be used in the query, it runs, no error, no data inserted.
I ran the query in MySQL command line after substituting some data in it to this effect:
INSERT INTO orders (date_created, customer_name, shipping_address, customer_email) VALUES (NOW(), 'shane', '2323 SD Street, 'email@email.com')
MySQL returns an error
The error is:
" 1054 - Unknown column 'date_created' in 'field list'
It is the second field in the table. the first is my autoincrement, order_id.
Does anyone have any idea about this? I think it might be the NOW(). But I am unsure, the field exists.
Thanks in advance,
Shanis