Bonjour à tous,

Je développe actuellement un site pour un ami et je suis confronté à un problème de syntaxe au niveau du code suivant :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
$req = $bdd->prepare('IF EXISTS (SELECT * FROM utilisateur_client WHERE (idClient= :idClient AND idUser= :idUser))
    UPDATE utilisateur_client SET (tauxClient= :tauxClient) WHERE (idClient= :idClient AND idUser = :idUser)
ELSE
    INSERT INTO utilisateur_client VALUES (idClient= :idClient, idUser= :idUser, tauxClient = :tauxClient)');
$req->execute(array(
	'idClient' => htmlspecialchars($_GET['idClient']),
	'idUser' => htmlspecialchars($_POST['idUser']),
	'tauxClient' => htmlspecialchars($_POST['tauxClient']),
	'idClient' => htmlspecialchars($_GET['idClient']),
	'idClient' => htmlspecialchars($_GET['idClient']),
	'idUser' => htmlspecialchars($_POST['idUser']),
	'tauxClient' => htmlspecialchars($_POST['tauxClient'])
	)) or die(print_r($req->errorInfo(), true));
J'ai eu beau chercher, je n'ai pas trouvé de solution, voici le message d'erreur quand je teste :
Array ( [0] => 42000 [1] => 1064 [2] => 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 'IF EXISTS (SELECT * FROM utilisateur_client WHERE (idClient= '1' AND idUser= '15' at line 1 )
Je vous remercie d'avance de l'aide que vous pourrez m'apporter.

Bon week-end ensoleillé !