jakebur01 Posted June 5, 2007 Share Posted June 5, 2007 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 More sharing options...
MemphiS Posted June 5, 2007 Share Posted June 5, 2007 $query"...your statement" or die(mysql_error()); this might show you the error... Link to comment https://forums.phpfreaks.com/topic/54227-trouble-updating-info/#findComment-268094 Share on other sites More sharing options...
jakebur01 Posted June 5, 2007 Author Share Posted June 5, 2007 this didn't give me the error. Link to comment https://forums.phpfreaks.com/topic/54227-trouble-updating-info/#findComment-268102 Share on other sites More sharing options...
mmarif4u Posted June 5, 2007 Share Posted June 5, 2007 Why u r using this: AND where Try simple AND Link to comment https://forums.phpfreaks.com/topic/54227-trouble-updating-info/#findComment-268107 Share on other sites More sharing options...
MemphiS Posted June 5, 2007 Share Posted June 5, 2007 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 More sharing options...
jakebur01 Posted June 5, 2007 Author Share Posted June 5, 2007 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 More sharing options...
jakebur01 Posted June 5, 2007 Author Share Posted June 5, 2007 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 More sharing options...
MemphiS Posted June 5, 2007 Share Posted June 5, 2007 $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 More sharing options...
mmarif4u Posted June 5, 2007 Share Posted June 5, 2007 Try the MemphiS above query, i hope it will help. Link to comment https://forums.phpfreaks.com/topic/54227-trouble-updating-info/#findComment-268118 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.