Hi i'm a newbie to PHP and MySQL. I was wondering if anyone could help me with some code to Add 1 to a number that is assigned to a person in the database.

So, the person types their name in a form. Then the form has to find that persons name in the database and add one to their assigned number.

Any help would be much appreciated.

Recommended Answers

All 2 Replies

It would be something like this:

UPDATE person_table 
SET person_number = person_number + 1 
WHERE person_name = 'this persons name'

It would be something like this:

UPDATE person_table 
SET person_number = person_number + 1 
WHERE person_name = 'this persons name'

Yep, the exact code I wrote. I managed to solve this problem about 30 minutes earlier.

Thanks.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.