0

How can I let the user chose how many results they want displayed on a page? For instance they should be able to specify if they want 11, 20, 233 or something to that effect.

2
Contributors
4
Replies
5
Views
10 Years
Discussion Span
Last Post by thunderbbolt
0

you have to use the limit statement in the query

example:

$sql = 'SELECT * FROM table LIMIT 0, 10';

where 0 is the starting position, which is the beginning and 10 is the user limit you want

0

you have to use the limit statement in the query

example:

$sql = 'SELECT * FROM table LIMIT 0, 10';

where 0 is the starting position, which is the beginning and 10 is the user limit you want

This will limit my users to 10, but what I want is for the user to be able to tell my database how many records they want displayed at a time.

0

the number that is limiting the results can be a variable. such as:

The variable $num can contain the number that the user selects.

$num = 10;
$sql = 'SELECT * FROM table LIMIT 0, ' . $num . ';

do you need me to make the selection code as well or can you figure it out?

0

the number that is limiting the results can be a variable. such as:

The variable $num can contain the number that the user selects.

$num = 10;
$sql = 'SELECT * FROM table LIMIT 0, ' . $num . ';

do you need me to make the selection code as well or can you figure it out?

I think I can figure it out I will let you know if I can't

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.