I am trying to update a record or insert it if it does not exist but I am having a hard time doing it and I can´t find where the problem is, can someone help me out and point me in the right direction
INSERT INTO `jml_fl_users`
'Lago de Guadalupe',
ON DUPLICATE KEY UPDATE
SET street = '200 Cisnes',
town = 'Lago de Guadalupe',
city = 'Cuautitlan Izcalli',
state = 'Mexico',
country = 'Mexico',
zipcode = '54760',
coordinates = '19.6285952093597,-99.25037122265627',
phone = '6148356117',
website = 'http://www.tlacaelelrl.com',
favoritebook = 'gttry',
aboutme = 'gttry',
birthdate = '1983-01-04'
id = 54;
why not do the check first.
If Not Exists(select (1) from ...........Where....)
Insert into ............
you know, you really should become friends wif da manual
look up the INSERT statement for the correct syntax
here, i'll help you this time... http://dev.mysql.com/doc/refman/5.1/en/insert.html
there is no SET keyword allowed in the ON DUPLICATE KEY clause, and no WHERE clause either
This topic is now archived. It is frozen and cannot be changed in any way.