Jump to content

mysql insert


Destramic

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

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.