Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New to the CF scene
    Join Date
    Jan 2012
    Posts
    9
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Check answer in database

    Hi,

    I have PHP forms and a MySQL database.

    The user enters their name.

    What is your name? [ FORM ]

    What I would then like to do is then ask the user to enter their input into forms - say I ask a question:

    What does C in CPU stand for? [ FORM ]

    The answer is stored in the database and if they answer correctly it adds 1 beside the user's name.

    Does anyone know of any code / tutorial that will help me to achieve this?

  • #2
    Senior Coder
    Join Date
    Jun 2008
    Location
    New Jersey
    Posts
    2,536
    Thanks
    45
    Thanked 259 Times in 256 Posts
    So are you trying to store a form into a DB? That's easily google-able, its a massively easy technique (just googling "store pho form into mysql" comes back with a ton of good results).

    Or are you trying to do something different?

  • Users who have thanked Keleth for this post:

    mv0010 (02-24-2012)

  • #3
    New to the CF scene
    Join Date
    Jan 2012
    Posts
    9
    Thanks
    1
    Thanked 0 Times in 0 Posts
    Thanks for your post.

    What I would like to do is store the answer and COMPARE the user's answer with the answer stored in the MySQL database table.

    The table structure may look like this:

    | id | username | question | answer | score

  • #4
    New Coder
    Join Date
    Sep 2011
    Posts
    80
    Thanks
    0
    Thanked 13 Times in 12 Posts
    Look at prepared statements in PHP and the insert and select statements in MYSQL.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •