Hey,

Ik ben ff snel bezig met een pagina voor Paypal, alleen ik krijg deze error:
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 'SET account_name = '[email protected]' WHERE user_id = '4' AND identity_servi' at line 1

in deze query:
INSERT INTO xf_user_identity (user_id, identity_service_id, account_name) VALUES ('".$user['user_id']."', 'Paypal', '".$forumnaam."') ON DUPLICATE KEY UPDATE xf_user_identity SET account_name = '".$email."' WHERE user_id = '".$user['user_id']."' AND identity_service_id = 'Paypal' "

en dit stukje code:

<?php
if(mysql_query("INSERT INTO xf_user_identity (user_id, identity_service_id, account_name) VALUES ('".$user['user_id']."', 'Paypal', '".$forumnaam."') ON DUPLICATE KEY UPDATE xf_user_identity SET account_name = '".$email."' WHERE user_id = '".$user['user_id']."' AND identity_service_id = 'Paypal' ") == FALSE)
{
	die("Error1".mysql_error());
}else{
}
?>


Wat doe ik fout?

Bedankt! Wouter.
Van de mysql manual:

INSERT INTO table (a,b,c) VALUES (1,2,3)
  ON DUPLICATE KEY UPDATE c=c+1;

Je update gedeelte is dus niet goed. Maak het als volgt:

INSERT INTO xf_user_identity (user_id, identity_service_id, account_name) 
VALUES ('".$user['user_id']."', 'Paypal', '".$forumnaam."') 
ON DUPLICATE KEY 
UPDATE account_name = '".$email."'" 

Reageren