ayok Posted September 19, 2008 Share Posted September 19, 2008 Hi, A short question. I've got this query $fetch = mysql_query("SELECT * FROM table LIMIT 0,3 ORDER BY date DESC")or die(mysql_error()); But then I get mysql error for the limit. I think because I order it based on the date. Could anybody tell why and how to fix this? Thank you, ayok Link to comment https://forums.phpfreaks.com/topic/125004-mysql_query-limit-doesnt-work/ Share on other sites More sharing options...
aebstract Posted September 19, 2008 Share Posted September 19, 2008 $fetch = mysql_query("SELECT * FROM table ORDER BY date DESC LIMIT 0,3")or die(mysql_error()); Try this, and I'm not sure about the 0,3.. I've always used a solid number such as 0 or 3, but I think it may have been the order you had it wrote out in. Link to comment https://forums.phpfreaks.com/topic/125004-mysql_query-limit-doesnt-work/#findComment-645901 Share on other sites More sharing options...
discomatt Posted September 19, 2008 Share Posted September 19, 2008 0,3 is fine, but yes, limit must be after group/order http://dev.mysql.com/doc/refman/5.0/en/select.html Link to comment https://forums.phpfreaks.com/topic/125004-mysql_query-limit-doesnt-work/#findComment-645934 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.