Forum Moderators: coopster

Message Too Old, No Replies

Setting pages in php

I am new to this forum and need help on setting pages.

         

salma123

10:33 pm on Jan 18, 2005 (gmt 0)

10+ Year Member



I am designing a game in php and using mysql to store the questions. This is working fine but i need help on how to update the question number.

e.g. Question 1
summit? <Next>

when i click on Next i would like to update the question number....

please can anyone help me?

thanx in advance..

jatar_k

11:32 pm on Jan 18, 2005 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Welcome to WebmasterWorld salma123,

how are you storing the questions? I realize they are in mysql but do you have answers and question numbers along with it?

Are the question numbers just text in the html page?

Are the questions actually on seperate html pages?

when you click next does it go to a different page or just pass some parameter to the same page that selects the next question in the db?

salma123

12:47 am on Jan 19, 2005 (gmt 0)

10+ Year Member



Thank you for your fast reply.
1. The questions and answers are stored in a mysql database. (as a single row per question).

2. The question numbers are generated randomly and then i want to print one question per page.

3. However when i try this using a for loop all the questions appear on the same page.

How could i possibly tell php to print each question on a separate page...

Thank u for ur help.

coopster

1:22 pm on Jan 19, 2005 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



If you only want one question per page, then you will probably only want to read one row from your database, randomly. I think jatar_k is leading you into the process a bit deeper though...for example, how are you going to keep track of which question the user has already had and answered?

salma123

2:16 pm on Jan 19, 2005 (gmt 0)

10+ Year Member



i have not yet considered how i will track which question has already been answered.

Basically i would like to know how i could display one question per page.

I have tried numerous scripts but they are not working....

please help.....

salma123

4:15 pm on Jan 19, 2005 (gmt 0)

10+ Year Member



SELECT *
FROM `whatevertable`
LIMIT 0 , 10

basically i have the above code to limit the questions retrieved from the database. but how do i tell the comp to display one question per page?

please help

jatar_k

12:55 am on Jan 20, 2005 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



are you using a script to write static pages? or you are just using a query in the script to show the questions.

I would think you could set a cookie for the user and store in the cookie what questions they have already seen.

you can serialize the data before you stick it in the cookie, then unserialize it on the next page and use it in your query.

maybe something like
SELECT * FROM whatevertable where question_id not in (3,5,17);
or whatever row numbers they have already seen

why do the questions have to be random?