Error in your SQL syntax near..

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
oskare100
Forum Commoner
Posts: 80
Joined: Sun Oct 29, 2006 5:47 am

Error in your SQL syntax near..

Post by oskare100 »

Hello,

When I try to run this script I get the error message "You have an error in your SQL syntax near 'where payer_email = 'oskare100@test.com'' at line 1" :

Code: Select all

$txn_id = "12345678910";
$payer_email = "oskare100@test.com";

//Connect to MySQL
mysql_connect("localhost", "test", "30053005") or die(mysql_error());

//Select file system database
mysql_select_db("test") or die(mysql_error());

$sql13 = "INSERT INTO paypal_sales (txn_id_refund) VALUES ('$txn_id') where payer_email = '$payer_email'";
$result13 = mysql_query($sql13) or die( mysql_error() );
I can't figure out what SQL syntax error it's talking about..

Best Regards
Oskar R
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

What sense makes the where clause in an insert statement?
Do you want to update an existing record?
Post Reply