theagonizer Posted November 10, 2007 Share Posted November 10, 2007 this works fine $result = mysql_query("SELECT ID, title, src, description FROM images WHERE ID = 0"); $row = mysql_fetch_array($result); however this... $result = mysql_query("SELECT ID, title, src, description, order FROM images WHERE ID = 0"); $row = mysql_fetch_array($result); .. did not work when I added the order field to the table in phpmyadmin. Then it returns "Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource. even though there is an order field." I have noticed that if I turn the "order" field from an int to a type varchar it then works. any ideas? Link to comment https://forums.phpfreaks.com/topic/76732-mysql-query-doesnt-like-my-phpmyadmin-fields/ Share on other sites More sharing options...
rajivgonsalves Posted November 10, 2007 Share Posted November 10, 2007 try SELECT `ID`, `title`, `src`, `description`, `order` FROM images WHERE ID = 0 Link to comment https://forums.phpfreaks.com/topic/76732-mysql-query-doesnt-like-my-phpmyadmin-fields/#findComment-388466 Share on other sites More sharing options...
theagonizer Posted November 10, 2007 Author Share Posted November 10, 2007 it worked! Thank you. anybody know why this code has worked for me for years and now all of a sudden I need the little quotes. Am I using antequated coding? Link to comment https://forums.phpfreaks.com/topic/76732-mysql-query-doesnt-like-my-phpmyadmin-fields/#findComment-388468 Share on other sites More sharing options...
PHP_PhREEEk Posted November 10, 2007 Share Posted November 10, 2007 the word order is a MySQL reserved word (used for sorting). if you escape it with backticks, `order`, MySQL treats it as a field name PhREEEk Link to comment https://forums.phpfreaks.com/topic/76732-mysql-query-doesnt-like-my-phpmyadmin-fields/#findComment-388477 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.