![]() |
#1
|
||||
|
||||
![]()
This is a very noobish question, but how do you properly subtract a value from all rows in a table? I've tried this:
PHP Code:
PHP Code:
__________________
|
#2
|
||||
|
||||
![]()
You'll have to get the current value(s) first and then subtract. The update function just sets the variable to whatever you tell it to, but cannot math at it.
This would be an example of how to reduce the current user's money: PHP Code:
PHP Code:
PHP Code:
__________________
Please do not contact me directly outside of Mysidia.
I also cannot troubleshoot code more than two years old - I legit don't remember it. Last edited by Kyttias; 02-07-2017 at 07:50 PM. |
#3
|
||||
|
||||
![]()
You can also create your own database function to add that functionality from mysql to Mysidia, so you avoid having two transactions, select and then update
class_database.php PHP Code:
PHP Code:
It depends on your taste. I've been adding some things from mysql to mysidia's database class in the last few days, that's why I'm giving this option xD
__________________
![]() ![]() ![]() asp.net stole my soul. |
#4
|
||||
|
||||
![]()
Yeah ... that's great ! Thank you for sharing this
![]()
__________________
![]() |
#5
|
||||
|
||||
![]()
Ohh ... I have a request.
I would like to install a second requirement. So I would like to have : mood - 2, but only if "is frozen" no. How is this going ? thanks in advance
__________________
![]() |
#6
|
||||
|
||||
![]()
It should be:
PHP Code:
PHP Code:
__________________
|
#7
|
||||
|
||||
![]()
Ah ... great !
it works, but with ' isfrozen = 'no' thank you, Dinocanid ![]()
__________________
![]() |
![]() |
Thread Tools | |
Display Modes | |
|
|
What's New? |
What's Hot? |
What's Popular? |