Jump to content


Photo

result listing problem


  • Please log in to reply
1 reply to this topic

#1 Adri

Adri
  • Members
  • Pip
  • Newbie
  • 2 posts

Posted 07 March 2006 - 11:34 AM

Hey all,
I heva this problem with the listing of my results. I have a lot of entries in the database and I retreieve them with:

$getentries = mysql_query("SELECT * FROM guestbook ORDER BY id DESC");

Now, I want to show them with 15 at a time. For this I use:

$start = $offset (=0, 15, 30, 45, depending on which page of the results you are)
$stop = $offset + 15

for ($i=$start; $i<=$stop; $i++) { echo $whatever; }

The problem is, that when $start=15 and $stop=30 he displays the same results as when $start=0 and $stop=15. He just always takes the first 15 results out of the array :s. How come?!?

#2 wickning1

wickning1
  • Members
  • PipPipPip
  • Advanced Member
  • 405 posts

Posted 07 March 2006 - 01:45 PM

Bad approach, use "SELECT * FROM guestbook ORDER BY id DESC LIMIT $start, 15"




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users