Jump to content

[SOLVED] very strange problem with update statement


Recommended Posts

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.

Reserved keyword?

 

You're right :D

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.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.