Jump to content

[SOLVED] Adding Values, how is it done?


nitation

Recommended Posts

Hello people,

 

I can insert a value for a field named amount in my database, what i wanna do now is to add another value and it sum it up. My question is how do i go about it? do i insert a new value in the amount field on another row and add it? if yes, how do i do that in php.

 

Thanks in advance

Link to comment
Share on other sites

@lemmin

 

You said if i keep the code somewhere. How can that be done. Do i need to insert each value for amount on a new row and sum it up or what. Please give me a rough idea on how to carry it out.

 

Thanks in advance

Link to comment
Share on other sites

It depends on how long you need to keep the old value. If it can only be changed while the user is logged in, but not after he/she has logged out once, then you can save the number in a session. If the value may be changed at a later time, the best way would probably be to keep the value in your database, like you said.

Link to comment
Share on other sites

@lemmin,

 

Thank you for your reply. The question now is; if am trying to insert an amount value for a user using an HTML form that will be stored in a database. Do i need to create another HTML form to add another value before they can be summed up. The reason am asking this is because, if i will be using the same HTML form to add the 1st and second value, how do i query the database to do the addition.

 

I hope am clearer

Link to comment
Share on other sites

Guest
This topic is now 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.