Web Analytics Made Easy -
StatCounter limit reults - CodingForum

Announcement

Collapse
No announcement yet.

limit reults

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • limit reults

    hello, i have the following code:


    Code:
             <?
    				$get_name = mysql_query("SELECT `id`, `name`, `link`, `value`, `description` from `offers` WHERE `countries` = 'us' LIMIT 25, 50");
     while($namerow = mysql_fetch_array($get_name)) {
      	$id = $namerow["id"];
    	$link = $namerow["link"];
    	$name = $namerow["name"];
    	$amount = $namerow["value"];
    	$desc = $namerow["description"];
    ?>
    and it says limit 25,50 which is supposed to only results 25-50 but instead its showing up 50 results on the page? the page where its limited 0, 25 works fine. also on the pages where its 50,75 its showing some of the same results from the other pages
    Ever want to see inside of a rave? Check out RedRoll and join our community of EDM lovers and rave fanatics.

  • #2
    You have misread the documentation.

    The syntax is
    Code:
       ... LIMIT offset, rowcount
    So if you always want 25 rows, always end your LIMIT with 25. All you change is the starting record number ("offset").
    Be yourself. No one else is as qualified.

    Comment


    • #3
      http://dev.mysql.com/doc/refman/5.5/en/select.html

      With two arguments, the first argument specifies the offset of the first row to return, and the second specifies the maximum number of rows to return. The offset of the initial row is 0 (not 1):
      Be yourself. No one else is as qualified.

      Comment


      • #4
        thanks!!!!
        Last edited by markman641; Aug 18, 2011, 05:27 PM.
        Ever want to see inside of a rave? Check out RedRoll and join our community of EDM lovers and rave fanatics.

        Comment

        Working...
        X