Reply to Re: sessions question

Your name:

Reply:


Posted by Rik on 12/19/06 01:14

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.

1. Start a session.
2. Have an autoincrement column in you database.
3. On the first insert, retrieve the mysql_insert_id() from the insert (see
the manual).
4. Store this ID in for instance $_SESSION['quix_id'].
5. On subsequent answers, do not INSERT the result, but UPDATE the result
where the autoincrement column equals $_SESSION['quix_id'].
--
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

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