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
4Boredom
Forum Contributor
Posts: 176 Joined: Tue Nov 08, 2005 4:29 pm
Post
by 4Boredom » Tue Oct 09, 2007 8:32 pm
I am trying to make a variable addition code like this
Code: Select all
$addedvalue = 5;
$mysqlvalue + $addedvalue = $totalvalue;
print($totalvalue);
totalvalue has been displaying as 0. It should not display as 0.
anyone know how to fix this
superdezign
DevNet Master
Posts: 4135 Joined: Sat Jan 20, 2007 11:06 pm
Post
by superdezign » Tue Oct 09, 2007 9:01 pm
Code: Select all
$totalvalue = $mysqlvalue + $addedvalue
Assignment always works in the order that whatever's on the left of the assignment operator (=) is given the value of whatever's on the right of it.
4Boredom
Forum Contributor
Posts: 176 Joined: Tue Nov 08, 2005 4:29 pm
Post
by 4Boredom » Tue Oct 09, 2007 9:11 pm
ok but now its counting like this
19 = 0 + 10
the result should be 10
4Boredom
Forum Contributor
Posts: 176 Joined: Tue Nov 08, 2005 4:29 pm
Post
by 4Boredom » Tue Oct 09, 2007 11:32 pm
so yeah the first rowset is adding 9 to the result... the next is adding 10... the next 11... what is going on.. ahhhhh lol