Results 1 to 3 of 3
Thread: Add 10 To The Limit?
Sep 22, 2011, 07:59 #1
- Join Date
- Sep 2011
- 0 Post(s)
- 0 Thread(s)
Add 10 To The Limit?
I am attempting to create a dynamic LIMIT clause in an SQL query, but to no prevail.
Basically, I have a query selecting all of the posts from a table called "posts".
From there, I have a LIMIT statement saying to limit it to whatever a variable called "pages" is equaled too.
$page = $_GET["page"] + 9; $q1 = $link->query("SELECT * FROM posts ORDER BY id DESC LIMIT $page");
(The page always has a GET variable "?posts=1".)
Well, this isn't working exactly how I wanted it to work.
You see, I want it to select 1 through 10 if $pages = 1.
If pages is equaled to 2, I want it to select from 11 to 20... And so forth.
How could I do this?