0

You can see I can successfully redirect values from one to this page.

$shipping_first_name = $_POST['shipping_first_name'];
$shipping_address= $_POST['shipping_address'];
$shipping_city = $_POST['shipping_city'];
$shipping_state = $_POST['shipping_state'];
$shipping_zip_code = $_POST['shipping_zip_code'];
$shipping_phone = $_POST['shipping_phone'];
$shipping_mobile =$_POST['shipping_mobile'];
$Shipping_email = $_POST['shipping_email'];

echo $shipping_address,$Shipping_email; // now this line shows contains but 

Order entry: this query returns nothing.
Error is query was empty. What do I do?

$qurey1 = 'INSERT INTO ecomm_orders
(order_id,order_date, customer_id, cost_subtotal,
cost_total, shipping_first_name, shipping_address, shipping_city, shipping_state,
shipping_zipcode, shipping_phone, shipping_mobile, shipping_email)
VALUES
(NULL,"'.$now.'",'.$customer_id.',0.00,0.00,"'.mysql_real_escape_string($shipping_first_name,$db).'",
"'.mysql_real_escape_string($shipping_address, $db).'",
"'.mysql_real_escape_string($shipping_city, $db).'",
"'.mysql_real_escape_string($shipping_state, $db).'",
"'.mysql_real_escape_string($shipping_zip_code, $db).'",
"'.mysql_real_escape_string($shipping_phone, $db).'",
"'.mysql_real_escape_string($shipping_mobile, $db).'",
"'.mysql_real_escape_string($Shipping_email, $db).'")';
mysql_query($query1,$db) or die (mysql_error($db));
$order_id=mysql_insert_id();

Prior to this query I run query to populate customer table successfully, using same method.
But what could be wrong?

4
  • 5
    May be just a typo, but you have inconsistent spelling of: qurey1, and later query1... Commented Jul 24, 2010 at 2:29
  • As a side note, if you use prepared statements, you can avoid all the mysql_real_escape_string and clean up the VALUES portion of the query. Commented Jul 24, 2010 at 4:23
  • thanks i spent hours to find out what was the prob. thanks Commented Jul 24, 2010 at 9:18
  • what is prepared statments? i m kind of fresher in php field. may b i m using this thing what it is? [:)] Commented Jul 24, 2010 at 9:19

2 Answers 2

2

Well, assuming all the variables placed into your MySQL query are not empty... Change the "$qurey1 =" (variable you put your query into) to "$query1 =". I believe you simply have a typo.

Sign up to request clarification or add additional context in comments.

Comments

1

Try using single quote rather than double quote to wrap values.

\''.mysql_real_escape_string($shipping_address, $db).'\',

Instead of

"'.mysql_real_escape_string($shipping_address, $db).'",

1 Comment

thanks for help and i wil try using single quote .its just that i am used to double quotes.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.