Stephen68 Posted October 10, 2009 Share Posted October 10, 2009 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 Quote Link to comment https://forums.phpfreaks.com/topic/177214-help-with-query/ Share on other sites More sharing options...
cags Posted October 10, 2009 Share Posted October 10, 2009 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. Quote Link to comment https://forums.phpfreaks.com/topic/177214-help-with-query/#findComment-934431 Share on other sites More sharing options...
Stephen68 Posted October 10, 2009 Author Share Posted October 10, 2009 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. Quote Link to comment https://forums.phpfreaks.com/topic/177214-help-with-query/#findComment-934492 Share on other sites More sharing options...
Stephen68 Posted October 10, 2009 Author Share Posted October 10, 2009 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 Quote Link to comment https://forums.phpfreaks.com/topic/177214-help-with-query/#findComment-934496 Share on other sites More sharing options...
cags Posted October 10, 2009 Share Posted October 10, 2009 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. Quote Link to comment https://forums.phpfreaks.com/topic/177214-help-with-query/#findComment-934501 Share on other sites More sharing options...
JAY6390 Posted October 11, 2009 Share Posted October 11, 2009 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 Quote Link to comment https://forums.phpfreaks.com/topic/177214-help-with-query/#findComment-934958 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.