smdufb Posted January 4, 2010 Share Posted January 4, 2010 Hi i get a funny error... here goes mysql_query("INSERT INTO categories (name) VALUES (kdjsbfksjd)"); will give me the error Unknown column 'kdjsbfksjd' in 'field list' it is looking for COLUMN names in the VALUES bracket?? i've spent hours reading other peoples posts with this error, checking my code (and reducing it to this) aswell as checking my mysql table. the table has 1 NOT NULL auto_increment PRIMARY column and 3 UTF8_unicode_ci text columns their names are not reserved words. i've dropped and created it several times. restarted the apache and mysql.. no luck. am i just stupid or blind ...i would appreciate some help. thanks Quote Link to comment https://forums.phpfreaks.com/topic/187133-unknown-column-in-field-list/ Share on other sites More sharing options...
PFMaBiSmAd Posted January 4, 2010 Share Posted January 4, 2010 Sting data values are enclosed in single-quotes to make them strings, rather than column names or other types of identifiers. Quote Link to comment https://forums.phpfreaks.com/topic/187133-unknown-column-in-field-list/#findComment-988225 Share on other sites More sharing options...
smdufb Posted January 4, 2010 Author Share Posted January 4, 2010 i've tried that also, i get a longer mysql error from that: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''name') VALUES ('kdjsbfksjd')' at line 1 and if i use double-quotes php complains obviously because the whole thing is already in double-quotes. Quote Link to comment https://forums.phpfreaks.com/topic/187133-unknown-column-in-field-list/#findComment-988227 Share on other sites More sharing options...
smdufb Posted January 4, 2010 Author Share Posted January 4, 2010 oh nevermind that i put the column also in single-quotes there. i guess it was stupid and not blind thanks Quote Link to comment https://forums.phpfreaks.com/topic/187133-unknown-column-in-field-list/#findComment-988230 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.