Jump to content

trouble updating info


jakebur01

Recommended Posts

hey i've echoed this onto the page and pasted it into mysql... i have an error in my mysql syntax...

 

I'm assuming I cannot use all of these "and where's" that i have in my code.

 

What would be an alternative way do do this?

 

 $conn = db_connect();

  // insert customer address
  $query = "UPDATE `orders` SET `c_phone` = '$c_phone', `c_email` = '$c_email', `card_type` = '$card_type', `card_number` = '$card_number', `card_month` = '$card_month', `card_year` = '$card_year', `card_name` = '$card_name', `three_number` = $amex_code, `total_amount` = $c_total, `total_cost` = $t_price, `total_shipping` = $c_ship WHERE `orders` .`ship_name` = '$name' AND WHERE `orders` .`amount` = '$t_price' AND WHERE `orders` .`ship_address` = '$address'";
  
  echo $query;

Link to comment
https://forums.phpfreaks.com/topic/54227-trouble-updating-info/
Share on other sites

Try:

$conn = db_connect();

  // insert customer address
  $query = "UPDATE `orders` SET `c_phone` = '$c_phone', `c_email` = '$c_email', `card_type` = '$card_type', `card_number` = '$card_number', `card_month` = '$card_month', `card_year` = '$card_year', `card_name` = '$card_name', `three_number` = $amex_code, `total_amount` = $c_total, `total_cost` = $t_price, `total_shipping` = $c_ship WHERE `ship_name` = '$name' AND `amount` = '$t_price' AND `ship_address` = '$address'";
  
  echo $query;

Link to comment
https://forums.phpfreaks.com/topic/54227-trouble-updating-info/#findComment-268110
Share on other sites

SQL query:

UPDATE `orders` SET `c_phone` = '555.555.5555',
`c_email` = '[email protected]',
`card_type` = 'VISA',
`card_number` = '5555666677778888',
`card_month` = '01',
`card_year` = '00',
`card_name` = 'mr. test',
`three_number` =123,
`total_amount` = ,
`total_cost` = 58.42,
`total_shipping` = 12.99 WHERE `ship_name` = 'mr. test' AND `amount` = '58.42' AND `ship_address` = '121 test lane'

MySQL said: Documentation
#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ' `total_cost` = 58.42, `total_shipping` = 12.99 WHERE `ship_name` = 'mr. test' A' at line 1

 

 

here is what echoed onto the page:

 

SQL query:

UPDATE `orders` SET `c_phone` = '555.555.5555',
`c_email` = '[email protected]',
`card_type` = 'VISA',
`card_number` = '5555666677778888',
`card_month` = '01',
`card_year` = '00',
`card_name` = 'mr. test',
`three_number` =123,
`total_amount` = ,
`total_cost` = 58.42,
`total_shipping` = 12.99 WHERE `ship_name` = 'mr. test' AND `amount` = '58.42' AND `ship_address` = '121 test lane'

MySQL said: Documentation
#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ' `total_cost` = 58.42, `total_shipping` = 12.99 WHERE `ship_name` = 'mr. test' A' at line 1

 

i pasted this into the sql and got the above error

Link to comment
https://forums.phpfreaks.com/topic/54227-trouble-updating-info/#findComment-268113
Share on other sites

sorry... this is what echoed onto the page.. :

 

UPDATE `orders` SET `c_phone` = '555.555.5555', `c_email` = '[email protected]', `card_type` = 'VISA', `card_number` = '5555666677778888', `card_month` = '01', `card_year` = '00', `card_name` = 'mr. test', `three_number` = 123, `total_amount` = , `total_cost` = 58.42, `total_shipping` = 12.99 WHERE `ship_name` = 'mr. test' AND `amount` = '58.42' AND `ship_address` = '121 test lane'

Link to comment
https://forums.phpfreaks.com/topic/54227-trouble-updating-info/#findComment-268114
Share on other sites

$conn = db_connect();

  // insert customer address
  $query = "UPDATE `orders` SET `c_phone` = '$c_phone', `c_email` = '$c_email', `card_type` = '$card_type', `card_number` = '$card_number', `card_month` = '$card_month', `card_year` = '$card_year', `card_name` = '$card_name', `three_number` = '$amex_code', `total_amount` = '$c_total', `total_cost` = '$t_price', `total_shipping` = '$c_ship' WHERE `ship_name` = '$name' AND `amount` = '$t_price' AND `ship_address` = '$address'";
  
  echo $query;

 

Just INSERT into the sql db and get the query it shows you after that...

Link to comment
https://forums.phpfreaks.com/topic/54227-trouble-updating-info/#findComment-268117
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.