Jump to content

mysql insert


Go to solution Solved by mac_gyver,

Recommended Posts

well this is truely embarrising...i have a insert statement which works within phpmyadmin but when using mysqli_query it returns a error.

INSERT INTO users (username, timestamp) VALUES ('test', UTC_TIMESTAMP())

 

Unknown column 'timestamp' in 'field list'

 

i've been playing about with this for a few hours now :suicide: ...tried changing the column name (timestamp), adding ` around column names as well as table name.

 

the column exists which is the strangest part, and ive even checked there is no space after the column name in the db.

 

whats going on please?

 

Link to comment
https://forums.phpfreaks.com/topic/293640-mysql-insert/
Share on other sites

  • Solution

in the same php script that's throwing the error about the column name, what is the output from a SHOW CREATE TABLE users query?

 

this type of error is typical of having multiple databases or tables and selecting the wrong database on the connection or using the wrong table name in the query, either due to different spelling of the database/table name (perhaps your table with the timestamp column is actually user, not users) or if you are on an operating system that is case-sensitive for file names, your correct database name or table name is capitalized differently, such as Users.

Link to comment
https://forums.phpfreaks.com/topic/293640-mysql-insert/#findComment-1501654
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.