Reply to Re: PHP MySQL Single Iteration for data manipulation

Your name:

Reply:


Posted by Rik on 10/03/02 11:51

Garry wrote:
> I am trying to create a multiple choice test based on a MySQL
> database in PHP and presenting just one question at a time for the
> user to read and slect the correct answer. If the correct answer is
> selected a congratulatory message is displayed and the correct count
> is incremented. If an incorrect answer is chosen, then display the
> correct answer. In both cases increment the question count and move
> on to the next question.
>
> The main reason for storing the questions in MySQL is to create a
> generic test wrapper that can be used for any kind of Multiple choice
> test.
>
>
> Thank you if you have any idea on how I can process just onbe
> (Row/Question) at a time.

So, your problem isn't that you want to process the results individually,
you want only 1 row from the database. Assuming you want to let them see
only one question, and then submit a form to the next page?

Possible solutions:
- add a field called 'question_number" or something, and query 'SELECT
question, answer FROM table WHERE questionnumber = the variable. The
variable could be increased after every answer, possibly using a GET or POST
variable.

- You could use a LIMIT $start, 1 at the end of your query, where $start is
also incremented after every question, again a GET or POST variable seems
logical.

If you want to use MySQL, I would suggest reading some tutorials on SQL /
query-building. If you want only one row, the SQL should give you only one,
don't try to let PHP sort it out.

Grtz,
--
Rik Wasmus

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация