dsaba Posted April 23, 2007 Share Posted April 23, 2007 php manual doesn't have anything for mysql_query syntax neither does the SQL manual, they only talk about sql code ONLY, no php i want to do this: $rownum = 3; $query = mysql_query("SELECT * FROM table ORDER BY datetime_modified DESC LIMIT $rownum, $rownum"); this is not the correct syntax: LIMIT $rownum, $rownum neither is this: LIMIT '$rownum', '$rownum' what is? -thanks Link to comment https://forums.phpfreaks.com/topic/48245-solved-mysql-limit-syntax/ Share on other sites More sharing options...
btherl Posted April 23, 2007 Share Posted April 23, 2007 Mysql uses this syntax LIMIT $offset, $rownum So for 3 rows beginning at the 0th row use LIMIT 0, 3 Be warned that limit syntax is not standard across all SQL systems. You will need to use the MySQL manual to find MySQL's syntax. Link to comment https://forums.phpfreaks.com/topic/48245-solved-mysql-limit-syntax/#findComment-235830 Share on other sites More sharing options...
dsaba Posted April 23, 2007 Author Share Posted April 23, 2007 -thanks turns out I was using it correctly it "didn't work" for another reason that I fixed Link to comment https://forums.phpfreaks.com/topic/48245-solved-mysql-limit-syntax/#findComment-235833 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.