Jump to content

Help with query


Stephen68

Recommended Posts

I'm getting an error trying to run this query, was wondering if somebody could peek at it and let me know what

is wrong with it. Is it the browser agent type that is messing it up?

 

INSERT INTO logs (' ','2009-10-10','127.0.0.1','innovate','Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.1.3) Gecko/20090824 Firefox/3.5.3 (.NET CLR 3.5.30729)')

 

Thanks for any help that I might get, funny thing is I thought it was working before lol..

 

Stephen

Link to comment
Share on other sites

Why in gods name do so many people say "I'm getting an error" and not bother listing what error it is? Help others to help yourself. My guess is the first field in your database is an autoincrement column and it doesn't like the space.  :shrug:

Link to comment
Share on other sites

sorry I normaly do post everthing

 

 

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 ''','2009-10-10','127.0.0.1','innovate','Mozilla/5.0 (Windows; U; Windows NT 6.0;' at line 1

 

 

I took out the space out but for some reason there looks to be another quote, that might be part of the

error message though. The first field is autoincrement.

Link to comment
Share on other sites

I fixed it but still don't know what was wrong with the first version. I change the query to adding field names

and then values.

 

INSERT INTO logs (field,field,field) VALUES ('value','value',value')

 

It work's not but if you can think of why the other way didn't I surely would like to know.

 

Stephen

Link to comment
Share on other sites

It depends on the version of MySQL you have. Some allow to insert an autoincrement value with '', others require that you submit nothing for it, meaning you have to specify the fields and values for all other items.

Link to comment
Share on other sites

Like it's been said above it's more than likely the auto_increment. did you specify the fieldname and value for that in your latest query that is running? if you have an auto increment field it's always best to use NULL for it's value without any quotation marks

Link to comment
Share on other sites

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.