How to increment a value in db on button click using php

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
junjua
Forum Newbie
Posts: 1
Joined: Mon Jul 27, 2009 11:02 pm

How to increment a value in db on button click using php

Post by junjua »

Dear Memebers,

I wanted to make to buttons named as add / delete. when I click on the add button the value stored agianst this button should be incrementedm, and the button will be disabled after one click, but the other button is enabled, when I click on the delete button the value incremented in the add button should be decremented and the values against the deleted should be inncremented. now the delete is diabled. It means when one is enabled the other one should be disabled and the values will be incremented and decremented against buttons clicks in db.

Plz do help me in that secnario. I am not been able to build the logic what to do.
iamngk
Forum Commoner
Posts: 50
Joined: Mon Jun 29, 2009 2:20 am

Re: How to increment a value in db on button click using php

Post by iamngk »

You can try through Ajax. On both button onclick, you can call the JavaScript function with different argument value. Based on argument value, you can disable and enable the buttons easily by JavaScript.
At the same time Ajax function can update the db count.
Post Reply