DrTrans Posted October 16, 2009 Share Posted October 16, 2009 <?php $connect = mysql_connect("localhost","damgears_evil","damgears"); mysql_select_db("damgears_evil"); $query = mysql_query("SELECT * FROM titles ORDER BY id DESC"); while($row = mysql_fetch_assoc($query)) { $dbid = $row['id']; $dbfname = $row['fname']; $dblname = $row['lname']; $dbkey = $row['key']; $dbskey = $row['skey']; $dbname = $row['sname']; $title = $row['title']; $dbstatus = $row['status']; $dbdate = $row['date']; $region = $row['region']; print "<center>\"$title\"<br>"; print "by $dbname <i>for $dbfname $dblname</i><br><br></center>"; } ?> Quote Link to comment https://forums.phpfreaks.com/topic/177947-only-get-the-last-20-records/ Share on other sites More sharing options...
Maq Posted October 16, 2009 Share Posted October 16, 2009 LIMIT 20 Quote Link to comment https://forums.phpfreaks.com/topic/177947-only-get-the-last-20-records/#findComment-938242 Share on other sites More sharing options...
GoneNowBye Posted October 16, 2009 Share Posted October 16, 2009 he means select * from table where x=y group by whatever LIMIT 20 this will limit it to 20 reconds if you want to limit it to 20 records after the first 10 LIMIT 10,20 Quote Link to comment https://forums.phpfreaks.com/topic/177947-only-get-the-last-20-records/#findComment-938259 Share on other sites More sharing options...
Maq Posted October 16, 2009 Share Posted October 16, 2009 if you want to limit it to 20 records after the first 10 Why would he want that? Quote Link to comment https://forums.phpfreaks.com/topic/177947-only-get-the-last-20-records/#findComment-938266 Share on other sites More sharing options...
GoneNowBye Posted October 16, 2009 Share Posted October 16, 2009 I was just noting the alternate syntax incase he ever needed it. or did why i did and not research and just make PHP (or whatever) ignore the first ten and limit 30. Quote Link to comment https://forums.phpfreaks.com/topic/177947-only-get-the-last-20-records/#findComment-938281 Share on other sites More sharing options...
Maq Posted October 16, 2009 Share Posted October 16, 2009 I was just noting the alternate syntax incase he ever needed it. or did why i did and not research and just make PHP (or whatever) ignore the first ten and limit 30. It's not an "alternate syntax" for the desired results. That would imply that using LIMIT 10,20 would yield the same results as LIMIT 20. Which it doesn't. Using LIMIT 0,20 would be considered an alternative syntax. Quote Link to comment https://forums.phpfreaks.com/topic/177947-only-get-the-last-20-records/#findComment-938296 Share on other sites More sharing options...
GoneNowBye Posted October 17, 2009 Share Posted October 17, 2009 limit y,x is a different (and thus alternate) syntax to limit x..... the OP now knows both versions of it... okay? Quote Link to comment https://forums.phpfreaks.com/topic/177947-only-get-the-last-20-records/#findComment-938437 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.