Hi all. I'm new to this forum and hope to find the solution to my problem.
What my problem is...
I have created a web site in php-mysql-apache.
It deals with online product orders. Assume there are 2 tables, "products" and "orders".
Assume that a customer selects some products and pressing "checkout" button the list of the selected products appears. I need to capture the product details and insert them to the "orders" table but it fails.
I use the following code:
<?php
mysql_connect("$host","$user","$pass");
mysql_select_db("$database");
mysql_query("insert into orders values (now(), '', '', '', item_code='$code_no', '', '', '', '')")
or die(mysql_error());
?>
I explain:
now() is the date today.
item_code is the column in "orders" table and "code_no" is the column in "products" table. I use "" because at the moment I'm not interested in these columns.
What I get from this code in the "orders" table is the correct date in the "order_date" column and a "1" in the "item_code" column.
How did this "1" come from?
Any obvious mistakes? Any proposal?
Many thanks in advance.