|
Posted by Tom on 12/19/06 19:30
On Tue, 19 Dec 2006 00:58:15 GMT, Acerola wrote...
>
>I've created a 10 question php quiz with 1 question for each page, so
>depending on their answer, it will say "Correct" or "Incorrect." So,
>there are 10 columns in the MySQL table for each question. My problem is
>that after each question, the next answer starts with a new record. So,
>if one person completes the quiz, there are 10 records. I'm pretty new
>to PHP, and I'm guessing this has something to do with sessions, but if
>someone can point me in the right direction, it would be appreciated.
You can use MySQL to do the work for you by having a primary key in your table
that auto-increments, and sounds like you already have that in place.
Once you've done an INSERT you can use the "mysql_insert_id()" function to
retrieve the unique number that auto-incremented from your last INSERT command.
Once you have that value you can store that somewhere or use it in other SQL
commands if needed.
Tom
--
Newsguy.com - Basic Accounts $39.95 / 12 months
[Back to original message]
|