.i have the following code:
session_start();
$host = \'localhost\';
$user = \'root\';
$pw = \'\';
$db = \'pmdb\';
mysql_connect($host,$user,$pw);
mys
You can use LIMIT m,n
to both limit the number of results you get and offset the results by a given amount.
Now you could do something like:
SELECT * FROM questions WHERE QuizID=1 LIMIT $page,5;
Where you calculate the $page
based on a $_GET
variable. But this won't solve your randomness.
You could always seed RAND($key) by a given key that you save in your session so you could ORDER BY RAND($key)
and use the above limit technique.
Probably the simplest to implement would be to get the entire result set, shuffle it and cache it. Then use a php to show only a specific chunk of the cache.
Since this is related to pagination. Let me tell you, LIMIT m,n may not be as fast as it sounds. Learn how to improve it and read more about Efficient Pagination Using MySQL