Experts Round Table Network
Navigate
Home
ArticleWiki
Forum
Journal
Search
Newsletter
Links
Tech News
expertsrt.com
Welcome Guest.
Username:
Password:
Remember me
Forgot your password?
Register
Error #1054 on INSERT
Welcome,
Guest
. Please
login
or
register
.
December 04, 2008, 12:03:04 AM
11306
Posts in
1249
Topics by
499
Members
Latest Member:
haulaslemycle
Home
Help
Search
Login
Register
Experts Round Table Network
|
Databases
|
MySQL
|
Error #1054 on INSERT
« previous
next »
Pages:
[
1
]
Print
Author
Topic: Error #1054 on INSERT (Read 277 times)
klitscher
Offline
Posts: 24
Error #1054 on INSERT
«
on:
October 13, 2006, 09:46:15 PM »
Hello all,
I'm having a problem inserting a row into a table...here is my SQL statement...
INSERT INTO `surveys` (`session_id`, `ip`, `meaning`, `life`, `christian`, `jesus`, `frequency`, `talkwithfriends`, `samegod`, `samegodwhy`, `heaven`, `heavenwhy`, `parents`, `siblings`, `otherfam`, `friends`, `clergy`, `stranger`, `opinion`, `question`, `drawing`, `email`, `gender`, `age`, `grade`, `state`, `religion`, `timestamp`)
VALUES (`0f26f8a7b8b5b00baa12eac50c2845ff`, `XXX.XXX.XXX.XXX`, `2`, `2`, `2`, `2`, `More than Twice Weekly`, `Often`, `Yes`, `Why or Why Not?`, `Yes`, `What are they like?`, `Never`, `Never`, `Never`, `Never`, `Never`, `Never`, `Extremely Favorable`, `f`, `1`, `xxx@xxxxxx.xxx`, `male`, `10`, `5th or Under`, `AL`, `Atheist`, NOW());
When you INSERT like this...do the columns have to be in the same order they are structurally....ie, col1 on my table is IP, col2 is session_id, etc.?
The specific error I am getting is:
#1054 - Unknown column '0f26f8a7b8b5b00baa12eac50c2845ff' in 'field list'
any help would be much appreciated...
Ken
Logged
VGR
Mentor
Offline
Posts: 682
Re: Error #1054 on INSERT
«
Reply #1 on:
October 14, 2006, 06:32:15 AM »
Hello,
First I think you don't need quotes around column names and non-char values, and even more you specifically shouldb't use backquotes (see SQL standard)
Then, the answer to your question is NO : no, the column names in the parentheses can be in any order and be a subset of the table definition, and this will work as long as all required (say, NOT NULL) columns do receive an acceptable value.
For your specific error, it means that the quotes do mangle the interpreter/parser so much that it fails to read your VALUES clause. Try to remove all unnecessary quotes and not to include a line break in your SQL phrase ;-))
INSERT INTO surveys (session_id,ip,meaning,life,christian,jesus,frequency,talkwithfriends,samegod,samegodwhy,heaven,heavenwhy,parents,siblings,otherfam,friends,clergy,stranger,opinion,question,drawing,email,gender,age,grade,state,religion,timestamp) VALUES ('0f26f8a7b8b5b00baa12eac50c2845ff','XXX.XXX.XXX.XXX',2,2,2,2,'More than Twice Weekly','Often','Yes','Why or Why Not?','Yes','What are they like?','Never','Never','Never','Never','Never','Never','Extremely Favorable','f',1,'
xxx@xxxxxx.xxx
','male',10,'5th or Under','AL','Atheist',NOW());
please give feedback if the error still arises. regards
Logged
techie overlord, answers all kind of questions on
http://www.europeanexperts.org
klitscher
Offline
Posts: 24
Re: Error #1054 on INSERT
«
Reply #2 on:
October 18, 2006, 08:17:16 PM »
Sorry for the delay...your response did help me out. I was unaware about the proper use of quotes, as i've pretty much been learning my sql structure from phpMyAdmin...and that's how they did it...regardless, I've got it working now, so thank you very much!
I've got another sql questions, but i'll post a new topic...
Logged
Pages:
[
1
]
Print
« previous
next »
Jump to:
Please select a destination:
-----------------------------
ERT 1.5
-----------------------------
=> Round Table Learning Center
=> Bug reports
-----------------------------
Legacy
-----------------------------
=> The next level
=> History of ERT
-----------------------------
Community Affairs
-----------------------------
=> Introductions
=> Ballot Box
===> Closed Polls
=> Soapbox
=> Propose and Consult
===> Propose and Consult...CLOSED
-----------------------------
Bits and Bytes
-----------------------------
=> Tips, Tricks, Snippets, Tidbits And General Pearls Of Wisdom
-----------------------------
Serverside Technology
-----------------------------
=> PHP
=> ASP
-----------------------------
Webservers
-----------------------------
=> Apache
=> IIS
-----------------------------
Databases
-----------------------------
=> MySQL
=> Access
=> MS SQL Server
-----------------------------
Clientside Technology
-----------------------------
=> HTML
=> CSS
=> Javascript
=> Flash
=> WAP/WML
-----------------------------
Web Technologies
-----------------------------
=> General Web Dev
=> Web Standards
=> XML
=> Online Marketing
-----------------------------
Graphics
-----------------------------
=> Graphics Design and Animation
-----------------------------
Programming
-----------------------------
=> .NET
=> JAVA
=> MS DOS Batch Scripting
=> Mathematics
=> C & C++
=> VB
=> Delphi
=> Algorithm design
-----------------------------
Operating Systems
-----------------------------
=> Windows (General)
=> NT Based (2K, 2K-03, NT, XP, Vista)
=> Open Source (All)
-----------------------------
Hardware
-----------------------------
=> Hardware General
=> Gamers Hardware (Advanced)
-----------------------------
Networking
-----------------------------
=> Home (small)
=> Office (large)
=> Internet
-----------------------------
Security
-----------------------------
=> General Security Issues
-----------------------------
Rants/Opinions/Proposals
-----------------------------
=> Site operation
Powered by SMF 1.1 RC2
|
SMF © 2001-2005, Lewis Media
Joomla Bridge by
JoomlaHacks.com