Jump to content

Archived

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

Prank

Adding variables

Recommended Posts

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

Share this post


Link to post
Share on other sites
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]

Share this post


Link to post
Share on other sites
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 $qty

Thanks for your help.

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites

×

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.