Jump to content

Simple Insert Into MySQL Query


JayIsAStar
Go to solution Solved by JayIsAStar,

Recommended Posts

I am trying to insert some information into a MySQL database

I hope someone can help tell me what I did wrong

 

My Code: http://pastie.org/8213129 - Before you ask $userid; is already defined on another page before this is included and i know that is not the issue.

 

Error:

Unknown column 'cgvdfbfx' in 'field list'

cgvdfbfx is the value of $posted222;

 

Thanks in advance,

Link to comment
Share on other sites

string data values must be enclosed by single-quotes inside the query statement so that they are treated as literal string data values, otherwise they are treated as identifiers (database, table, or column names - which is what is occurring in your case) or treated as mysql keywords, functions, or operators.

 

programming requires that you know the meaning of everything in the code in front of you. to successfully write a sql query statement, you must know the syntax for the type of query you are writing, what the keywords, functions, and operators mean and where they go in the query, where the identifiers (database, table, or column names) go, where the data values go, and how to treat each different type of data.

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.