Jump to content
xisto Community
mrdee

Looking For Some Php Code Trying to add some numbers in a MySQL database

Recommended Posts

I have a program for generating online quizzes which makes nice looking pages and gives lots of possibilities for different kinds of questions/answers.

 

Unfortunately it does not support putting the results into a MySQL database, unless you set up a quite expensive account with the makers of the software.

 

Adding my list of users and their details to a MySQL database is simple enough, but what I am looking for is a small script (preferably with a form) to update the scores (and maybe the number of quizzes taken), but which leaves all the other elements alone.

 

For example: John Smith has taken 1 quiz and scored 8 points in that, he takes anew one and scores 10 points.

I just want to be able to call up his record and enter that he scored 10 points, and see those 10 points added to his 8 he already had, making it 18 in total. And maybe also that his number of quizzes taken increases to 2 (although an auto-increase should be able to do that, I guess).

 

I then want to be able to display the quiz ranking on my website, that is simple enough, and, if I am not mistaken (correct me if I am wrong, please) there is a function in PHP which allows you to sort a database table in a certain field (that would be the total score then) ascending or descending, so if I am right, that would be simple enough to achieve too.

(It would also be nice if the ranking place could be shown).

 

So, before and after an update, the display should be something like:

 

Before:

 

Place Name Quizzes taken Total

1 Alice Jones 1 9

2 John Smith 1 8

 

After:

(John scored 10, Alice scored 8)

 

Place Name Quizzes taken Total

1 John Smith 2 18

2 Alice Jones 2 17

Sorry if I express myself in a clumsy manner sometimes, but I am a novice (trying to learn more) in PHP and still need all the help I can get.

 

So, if anyone can give me a few pointers to solve this little problem (I assume it is not that difficult to do, but as my knowledge is quite limited....) I would be very grateful.

 

Thank you very much in advance.

Edited by mrdee (see edit history)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.