select by range

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
User avatar
ol4pr0
Forum Regular
Posts: 926
Joined: Thu Jan 08, 2004 11:22 am
Location: ecuador

select by range

Post by ol4pr0 »

Lets say i have a database with about 100 differant items.

How would i go about on doing this..

Code: Select all

//db connecting and all that

$result = mysql_query("SELECT first 10 items FROM items");

// some table..
echo "0>10 items";

$result = mysql_query("SELECT 10>20 items FROM items");
// second table
 "10>20 items";


// 3th
ect.....
Does this make any sence?
User avatar
andre_c
Forum Contributor
Posts: 412
Joined: Sun Feb 29, 2004 6:49 pm
Location: Salt Lake City, Utah

Post by andre_c »

I think this is what you mean

Code: Select all

SELECT * FROM table LIMIT 1, 10  //start on first row, get ten rows
SELECT * FROM table LIMIT 11, 10   //start on eleventh row, get ten rows
User avatar
ol4pr0
Forum Regular
Posts: 926
Joined: Thu Jan 08, 2004 11:22 am
Location: ecuador

Post by ol4pr0 »

Let me give that a try ;-)
Post Reply