Destramic Posted January 4, 2015 Share Posted January 4, 2015 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 ...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? Quote Link to comment https://forums.phpfreaks.com/topic/293640-mysql-insert/ Share on other sites More sharing options...
Solution mac_gyver Posted January 4, 2015 Solution Share Posted January 4, 2015 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. Quote Link to comment https://forums.phpfreaks.com/topic/293640-mysql-insert/#findComment-1501654 Share on other sites More sharing options...
Destramic Posted January 4, 2015 Author Share Posted January 4, 2015 was a simple as me connecting to the wrong db!...silly me...thank you for your reply and help Quote Link to comment https://forums.phpfreaks.com/topic/293640-mysql-insert/#findComment-1501747 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.