Lassie Posted October 14, 2014 Share Posted October 14, 2014 I have a table 'combo' with two fields, id and char. I want to populate a table, with the following query which fails. $sql = mysql_query("SELECT id,char FROM combo ORDER BY id DESC LIMIT 28"); I a bit rusty on sql but can't see what is wrong with this. Can anyone help please. Quote Link to comment https://forums.phpfreaks.com/topic/291618-basic-query-problem/ Share on other sites More sharing options...
Solution Barand Posted October 14, 2014 Solution Share Posted October 14, 2014 CHAR is a MySQL reserved word. Either enclose it in backticks (`char`) or, better still, change the column name. http://dev.mysql.com/doc/refman/5.5/en/reserved-words.html Quote Link to comment https://forums.phpfreaks.com/topic/291618-basic-query-problem/#findComment-1493527 Share on other sites More sharing options...
Lassie Posted October 14, 2014 Author Share Posted October 14, 2014 Thank. Said I was rusty. Quote Link to comment https://forums.phpfreaks.com/topic/291618-basic-query-problem/#findComment-1493532 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.