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 Quote Link to comment 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. Quote Link to comment 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 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.