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. Link to comment https://forums.phpfreaks.com/topic/291618-basic-query-problem/ Share on other sites More sharing options...
Barand Posted October 14, 2014 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 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. Link to comment https://forums.phpfreaks.com/topic/291618-basic-query-problem/#findComment-1493532 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.