#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2012
    Posts
    11
    Rep Power
    0

    Online test project using PHP


    Hi everyone,

    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.
  2. #2
  3. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2012
    Location
    Burb of Detroit, Michigan
    Posts
    90
    Rep Power
    77
    When I was in college I took a series of flash courses and create a bunch of games. One was an online trivia game that incorporated a little php, which was the first time I worked with php. Anyways, the best way to do something like that would to be to use some kind of server-side programming language (PHP for example) and a client-side programming language, such as AJAX(Javascript), Flash, etc...
  4. #3
  5. Transforming Moderator
    Devshed Supreme Being (6500+ posts)

    Join Date
    Mar 2007
    Location
    Washington, USA
    Posts
    14,122
    Rep Power
    9398
    Originally Posted by Strider64
    When I was in college I took a series of flash courses and create a bunch of games. One was an online trivia game that incorporated a little php, which was the first time I worked with php. Anyways, the best way to do something like that would to be to use some kind of server-side programming language (PHP for example) and a client-side programming language, such as AJAX(Javascript), Flash, etc...
    Trying to figure out how that's helpful...

    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
    Code:
    LIMIT offset, 5
    where offset = (page number from the URL - 1) * 5.

IMN logo majestic logo threadwatch logo seochat tools logo