Jump to content

Counting field and update database


phpnewbie112

Recommended Posts

Hi everyone, I am new to php and I was trying hard to alter an existing script ut I didn't succeed to...  :(

 

I have 2 databases:

- Categories (catid, shortname, description)

- Transactions (date, amount, balance, user)

 

in the categories I have 9 categories.

 

the script displays the categories as checkboxes to choose from. I want to add the following functionality:

 

If I select for example 3 categories, I would like to know how can I count the selected checkboxes and based on the count update the transactions database:

 

in another way:

if count=3 => add amount  x 3 to the transactions database so if a user select 4 categories I update the transaction database with $5 x 4 categories and then we will get a balance of $20 for the choosen categories.

 

 

 

 

Link to comment
https://forums.phpfreaks.com/topic/77119-counting-field-and-update-database/
Share on other sites

I fixed the duplicates issue.

 

If I select 6 categories I have an output with 6 which is good.

 

When I came back to this page, it shows the existing choosed 6, so now if I re-select 2 new categories I have an output of 8. How can I make it output 2 rather then 8.

 

Thanks a lot

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

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.