wolfrat Posted January 2, 2008 Share Posted January 2, 2008 Hey everyone, am making a simple clicktracker sort of thing, and am running into trouble updating the system. This is the statement I use (id is already sanitized, afila is the name of my table, and out is the column of 'click' values): UPDATE afila SET out=out+1 WHERE id='$id' However, when I try to execute that command, I get: SQL query: UPDATE afila SET out = out +1 WHERE id = '1' MySQL said: Documentation #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 'out=out+1 WHERE id='1'' at line 1 and here is my table structure: -- phpMyAdmin SQL Dump -- version 2.10.0.2 -- http://www.phpmyadmin.net -- -- Host: ************ -- Generation Time: Jan 02, 2008 at 10:43 PM -- Server version: 5.0.41 -- PHP Version: 5.2.5 SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO"; -- -- Database: `***data` -- -- -------------------------------------------------------- -- -- Table structure for table `afila` -- CREATE TABLE `afila` ( `id` int(3) NOT NULL auto_increment, `in` int(6) NOT NULL, `out` int(6) NOT NULL, `name` varchar(60) NOT NULL, `image` varchar(400) NOT NULL, `url` varchar(400) NOT NULL, PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=2 ; Any help would be much appreciated. Quote Link to comment https://forums.phpfreaks.com/topic/84200-solved-very-strange-problem-with-update-statement/ Share on other sites More sharing options...
fenway Posted January 2, 2008 Share Posted January 2, 2008 Reserved keyword? Quote Link to comment https://forums.phpfreaks.com/topic/84200-solved-very-strange-problem-with-update-statement/#findComment-428752 Share on other sites More sharing options...
wolfrat Posted January 2, 2008 Author Share Posted January 2, 2008 Reserved keyword? You're right I feel stupid now, I thought I would never need to know about reserved keywords. Quote Link to comment https://forums.phpfreaks.com/topic/84200-solved-very-strange-problem-with-update-statement/#findComment-428758 Share on other sites More sharing options...
fenway Posted January 3, 2008 Share Posted January 3, 2008 Reserved keyword? You're right I feel stupid now, I thought I would never need to know about reserved keywords. If you put an underscore in every column name, you're almost certain never to have to deal with them. Quote Link to comment https://forums.phpfreaks.com/topic/84200-solved-very-strange-problem-with-update-statement/#findComment-429273 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.