Jump to content

creating a sum from a variable result


guymclaren

Recommended Posts

Before anyone has a go at me, I have Googled, tried to create an array from the result and have failed miserably. In essence what I have is a result from a sql query multiplied with another giving me a row total.

 

while row exists
$var = $result1 * $result2 

Now I want to total up $var1 which could be a single entry or a list of entries. I have tried to create an array

               for($i = 0; $i < count($var); $i++){ 
	 		echo $var[$i].","; } 

Get no result, except ,

 

$val1 = array($var[$i]);
echo $val1;

No result

 

PLease help, my brain is not co-operating today.

Link to comment
https://forums.phpfreaks.com/topic/240092-creating-a-sum-from-a-variable-result/
Share on other sites

Archived

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