0

I have a table test with following structure:

CREATE TABLE IF NOT EXISTS `test` (
  `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  `user_id` int(11) unsigned NOT NULL,
  `lat` varchar(100) NOT NULL,
  `long` varchar(100) NOT NULL,
  `updatedon` datetime NOT NULL,
  `addedon` datetime NOT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `user_id` (`user_id`)
) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=3 ;

and I am trying to use following queries none are working:

INSERT INTO `test` (`user_id`, `lat`, `long`)
 VALUES ('1', 'latv', 'longv')
ON DUPLICATE KEY UPDATE
  lat=VALUES(lat),
long = VALUES(long)

INSERT INTO `test` (`user_id`, `lat`, `long`)
 VALUES ('1', 'latv', 'longv')
ON DUPLICATE KEY UPDATE
  lat="test_lat",
long = "test_long"

here is the error for one query:

#1064 - 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 'long = VALUES(long)' at line 5 

I am trying this in phpmyadmin.

cchapman
  • 3,269
  • 10
  • 50
  • 68
Faiyaz Alam
  • 1,191
  • 9
  • 27

0 Answers0