plutomed Posted February 24, 2007 Share Posted February 24, 2007 Can anyone tell me what this means and how i can solve it? 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 'WHERE show='1'' at line 1 Link to comment https://forums.phpfreaks.com/topic/39902-solved-you-have-an-error-in-your-sql-syntax/ Share on other sites More sharing options...
Archadian Posted February 24, 2007 Share Posted February 24, 2007 please post the code you are having problems with Link to comment https://forums.phpfreaks.com/topic/39902-solved-you-have-an-error-in-your-sql-syntax/#findComment-192885 Share on other sites More sharing options...
plutomed Posted February 24, 2007 Author Share Posted February 24, 2007 $result = mysql_query("SELECT * FROM templates ORDER BY id DESC LIMIT " . $start_from . ", 5 WHERE show='1'") or die(mysql_error()); Link to comment https://forums.phpfreaks.com/topic/39902-solved-you-have-an-error-in-your-sql-syntax/#findComment-192886 Share on other sites More sharing options...
Archadian Posted February 24, 2007 Share Posted February 24, 2007 I believe LIMIT goes after WHERE if im not mistaken Also, try '$start_from' instead of " . $start_from . " I've gotten errors like that before because of that Link to comment https://forums.phpfreaks.com/topic/39902-solved-you-have-an-error-in-your-sql-syntax/#findComment-192888 Share on other sites More sharing options...
plutomed Posted February 24, 2007 Author Share Posted February 24, 2007 it doesnt like the where command for some reason ??? because wherever i put it at repeats the code after it 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 'WHERE show='1' LIMIT 0, 5' at line 1 Link to comment https://forums.phpfreaks.com/topic/39902-solved-you-have-an-error-in-your-sql-syntax/#findComment-192891 Share on other sites More sharing options...
Archadian Posted February 24, 2007 Share Posted February 24, 2007 try putting the WHERE after FROM templates Link to comment https://forums.phpfreaks.com/topic/39902-solved-you-have-an-error-in-your-sql-syntax/#findComment-192892 Share on other sites More sharing options...
plutomed Posted February 24, 2007 Author Share Posted February 24, 2007 no but its in the right place because it says show='1' not WHERE show='1' 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 'show='1' ORDER BY id DESC LIMIT 0, 5' at line 1 Link to comment https://forums.phpfreaks.com/topic/39902-solved-you-have-an-error-in-your-sql-syntax/#findComment-192893 Share on other sites More sharing options...
AndyB Posted February 24, 2007 Share Posted February 24, 2007 http://dev.mysql.com/doc/refman/5.0/en/reserved-words.html show is a reserved word and should NOT be used as a column (field) name. Link to comment https://forums.phpfreaks.com/topic/39902-solved-you-have-an-error-in-your-sql-syntax/#findComment-192949 Share on other sites More sharing options...
plutomed Posted February 24, 2007 Author Share Posted February 24, 2007 thankyou but i fixed it its: $result = mysql_query("SELECT * FROM templates WHERE `show` = 1 ORDER BY id DESC LIMIT " . $start_from . ", 5") or die(mysql_error()); Link to comment https://forums.phpfreaks.com/topic/39902-solved-you-have-an-error-in-your-sql-syntax/#findComment-192997 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.