Do I use java script or php for adding or subtracting a given amount from a database | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Do I use java script or php for adding or subtracting a given amount from a database

so I'm beginning to understand the use of php and js and I have a situation. I created an inventory system but I'm still unclear on creating sales. my idea was to have a sale form to send the updated information back to the dB (eg new stock amount and the saleid). however, I would like to implement a counter so when the item that was added can be (eg 1 pen and when the add button next to the item was pressed it would be 2 pens). after the sale it would then be deducted from the inventory (10 pens - 2)

2nd Apr 2018, 6:34 PM
Asa De Nobriga
Asa De Nobriga - avatar
2 Answers
+ 5
I think JavaScript and PHP can both be of use for that, I remember a friend here created a tutorial on how to use JavaScript to send request to a PHP back-end code, and receive response in JSON (if I'm not mistaken), shamefully that friend is no longer here, so the tutorial in the code can no longer be accessed
2nd Apr 2018, 6:48 PM
Ipang
+ 1
would this increment item/decrement item be php or java script? thanks to anyone who can clear this up for me. <3
2nd Apr 2018, 6:35 PM
Asa De Nobriga
Asa De Nobriga - avatar