April 10th, 2013, 01:42 AM
Online test project using PHP
I am developing online test project.I have 100 questions in my database. In this,we need to retrieve 5 questions for each time and display on the screen.For every 5 questions we need to write a separate program or is it possible to write in single program ?
Please suggests me the solution.
April 10th, 2013, 06:14 AM
April 10th, 2013, 12:55 PM
Trying to figure out how that's helpful...
Originally Posted by Strider64
akkemraju, you can do it with one script. In fact it's easier. This is pagination.
When you do a query to get the list of questions to show, make it return a maximum of five. Then you need to tell the script what page it's on: that's as simple as putting a ?page=1 in your URL (and assuming page=1 if it's missing). Using MySQL your LIMIT clause looks like
where offset = (page number from the URL - 1) * 5.