oskare100 Posted January 22, 2007 Share Posted January 22, 2007 Hello,I get this error message "You have an error in your SQL syntax" but I can't find anything wrong with my code.Here is the problem:[code=php:0]$sql45="INSERT INTO $user_tbl (username, password, ebay_username, ebay_status, ebay_email, paypal_status, paypal_email, num_purchases, business, first_name, last_name, address_street, address_city, address_state, address_zip, address_country, address_status, created) VALUES ($payer_email, $password, $auction_buyer_id, $ebay_status, , $ebay_email, $payer_status, $payer_email, 1, $business, $first_name, $last_name, $address_street, $address_city, $address_state, $address_zip, $address_country, $address_status, NOW())";$result45=mysql_query($sql45) or die( mysql_error() );[/code]Could you please take a look at it and see if you can find anything? Best RegardsOskar R Link to comment https://forums.phpfreaks.com/topic/35198-you-have-an-error-in-your-sql-syntax-but-cant-find-it/ Share on other sites More sharing options...
vbnullchar Posted January 22, 2007 Share Posted January 22, 2007 try doing it like this... put single quotes [code]VALUES ('$payer_email', '$password', '$auction', etc...)[/code] Link to comment https://forums.phpfreaks.com/topic/35198-you-have-an-error-in-your-sql-syntax-but-cant-find-it/#findComment-166206 Share on other sites More sharing options...
oskare100 Posted January 22, 2007 Author Share Posted January 22, 2007 Hello,That solved the problem, but now I get the same error with this code:[code=php:0]// It is a file pack$sql46="INSERT INTO $sales_tbl (user_id, pack_id, ebay_item_name, ebay_item_id, ebay_txn_id, shipped_marked, paid_marked, payment_status, payment_date, payment_gross, payment_tax, payment_currency, payment_type, paypal_txn_id, paypal_memo, auction_closing_date, auction_multi_item, received) ) VALUES('".$row['user_id']."', '".$ident_row['pack_id']."', '$item_name', '$item_number', '$ebay_transaction_id', '$shipped_marked', '$paid_marked', '$payment_status', '$payment_date', '$mc_gross', '$tax', '$mc_currency', '$payment_type', '$txn_id', '$memo', '$auction_closing_date', '$auction_multi_item')";$result46=mysql_query($sql46) or die( mysql_error() );[/code]And it didn't help to add single quotas to it.. Can you see anything else with it? Thanks in advance,Oskar R Link to comment https://forums.phpfreaks.com/topic/35198-you-have-an-error-in-your-sql-syntax-but-cant-find-it/#findComment-166208 Share on other sites More sharing options...
vbnullchar Posted January 22, 2007 Share Posted January 22, 2007 [code]$sql45="INSERT INTO $user_tbl (user_id, etc..) VALUES('$row[user_id]','$ident_row[pack_id]', 'item_name', etc...)";[/code] Link to comment https://forums.phpfreaks.com/topic/35198-you-have-an-error-in-your-sql-syntax-but-cant-find-it/#findComment-166210 Share on other sites More sharing options...
oskare100 Posted January 22, 2007 Author Share Posted January 22, 2007 Problem solved. Link to comment https://forums.phpfreaks.com/topic/35198-you-have-an-error-in-your-sql-syntax-but-cant-find-it/#findComment-166214 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.