Prank Posted April 14, 2006 Share Posted April 14, 2006 Hi Guys,I am a bit unsure of how to do this, I'd appreciate any help.What I am trying to do is add up a total number as reported by variables, but the problem is that its the same variable..For eg;[code]while {$total = 3;}[/code]How would I add all the $total's for each instance that the 'while' was run?I hope this makes sense and I am assuming it is an easy answer..Thanks in advance,Christian Link to comment https://forums.phpfreaks.com/topic/7374-adding-variables/ Share on other sites More sharing options...
jworisek Posted April 14, 2006 Share Posted April 14, 2006 well, you could just do something like this. You do need a condition in your while statment though....[code]$count=0;while ( /*some condition*/ ){$total = 3;$count++;}[/code] Link to comment https://forums.phpfreaks.com/topic/7374-adding-variables/#findComment-26849 Share on other sites More sharing options...
Prank Posted April 14, 2006 Author Share Posted April 14, 2006 So that would just add a 1 to the variable $count each time its run?Heres my actual code; [a href=\"http://pastebin.com/658997\" target=\"_blank\"]http://pastebin.com/658997[/a]I need to grab the total value of $total and $qtyThanks for your help. Link to comment https://forums.phpfreaks.com/topic/7374-adding-variables/#findComment-26852 Share on other sites More sharing options...
Prank Posted April 14, 2006 Author Share Posted April 14, 2006 nm, i figured it out.. stupidly simple. Link to comment https://forums.phpfreaks.com/topic/7374-adding-variables/#findComment-26860 Share on other sites More sharing options...
kenrbnsn Posted April 14, 2006 Share Posted April 14, 2006 Can you post the solution to your problem, so other people can learn from your experience?BTW, I took a look at your code. Do you realize your creating one form each time you go through the 'while' loop?Ken Link to comment https://forums.phpfreaks.com/topic/7374-adding-variables/#findComment-26870 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.