Skip to main content
GameDev.net gamedev.net
🔒 Locked

Php / Mysql Page Problem

Started by Ketay Jan 5, 2003 at 9:27 PM 1 replies 300+ views
Original Post
Ketay
Ketay
Okay I want to list my weapons with 10 on each page. What I have is: $ms = mysql_fetch_row( mysql_query("SELECT COUNT(id) FROM mb2 where topic=''$post''") ); $a = $page * 10; $b1 = $page + 1; $b2 = $b1 * 10; $b = $b2 - 1; $select_11 = mysql_query("select * from mb2 where topic = ''$post'' order by id ASC Limit $a,$b"); And then I have the While loop but it doesnt list like I want it to. When $page = "0" then it lists from id 0 - 9 which works fine, but when $page = "1" then it lists from 10 - 29... then when $page = "2" it lists from 21 - 49 X.x;; I cant quite figure out what im doinf wrong... so any help would be great! -Moo-
-Moo-
spock
spock
When you use two arguments to the MySQL LIMIT clause, the first argument is the offset and the second is the number of rows to retrieve. So you probably want the query to look like this instead:

... order by id asc limit $a,10
Ketay
Ketay
Okay... well thats the last time I just randomly pick an internet tutorial to learn from. But thanks

-Moo-
-Moo-

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.