Rocco The Taco
Rocco The Taco

Reputation: 3777

MySQL use of LIMIT

I have two recordset I'm using to select and display data. The following query works great and shows me the first 25 records.

SELECT * 
  FROM table1 
 WHERE Field3 = '".$currentag."' 
   AND Field1 = 'A' 
   AND Field1 != 'D' 
 LIMIT 25

How do I create a new, separate query to display records AFTER the initial 25 records are returned?

Upvotes: 0

Views: 36

Answers (2)

Rohan Sable
Rohan Sable

Reputation: 25

Syntax for LIMIT $point,$offset is that $point means starting point and $offset is number of entries you want to display so for your query solution is LIMIT 25,25 then dynamically you pass values as a variable from frontend to these 2variables.

Upvotes: 0

cn0047
cn0047

Reputation: 17061

You have to use offset:

SELECT * FROM table1
WHERE Field3 = '".$currentag."' AND Field1 = 'A' AND Field1 != 'D'
LIMIT 25, 25

One more batch:

SELECT * FROM table1
WHERE Field3 = '".$currentag."' AND Field1 = 'A' AND Field1 != 'D'
LIMIT 50, 25

Here 50 - is offset and 25 - is limit.

Upvotes: 1

Related Questions