INSERT ON DUPLICATE KEY in mysql

when i echo this part of my script it looks correct. when i try to run it in the sql window of myphpadmin i get back a 1064 syntax error. all of the globals and variables on the page have proper values when echo is run. i have tried to just put string values instead of variables and it still won’t insert or update database. table is school
using MySql 5.3.4
thanks for any help you can give me
//////////////////////////////////
$sql = “INSERT into school
(id,
full_name,
accCode,
school_name,
group1,
group1items,
group2,
group2items,
group3,
group3items,
group4,
group4items)
VALUES
(’$id’,
‘$user’,
‘$accCode’,
‘$school’,
‘$group1New’,
‘$group1itemsNew’,
‘$group2New’,
‘$group2itemsNew’,
‘$group3New’,
‘$group3itemsNew’,
‘$group4New’,
‘$group4itemsNew’)
ON DUPLICATE KEY UPDATE school SET
id=’$id’,
full_name=’$user’,
accCode=’$accCode’,
school_name=’$school’,
group1=’$group1New’,
group1items=’$group1itemsNew’,
group2=’$group2New’,
group2items=’$group2itemsNew’,
group3=’$group3New’,
group3items=’$group3itemsNew’,
group4=’$group4New’,
group4items=’$group4itemsNew’
WHERE id = ‘$user_id’”;
mysql_query($sql);
////////////////////////////////////////////////////////

take away the single quotes here[php]’$id’[/php]here[php]id=’$id’,[/php]and here[php]’$user_id’";[/php]

so you have: [php]$id | $id | $user_id[/php]
:wink:

Sponsor our Newsletter | Privacy Policy | Terms of Service