Warning: array_sum() [function.array-sum]: The argument should be an array in pdf.php on line 112

i am getting this error and i dont see what the problem is. it calls values and adds them

$result = mysql_query("SELECT * FROM sold_produce WHERE invoice_id='$invoice_id' ");
        while($myrow = mysql_fetch_assoc($result))
             { 
  $total2[] = $myrow['total'];
	}
	$content .= array_sum($total2);

Recommended Answers

All 5 Replies

Member Avatar for rajarajan2017
$result = mysql_query("SELECT * FROM sold_produce WHERE invoice_id='$invoice_id' ");
$total2=array();
        while($myrow = mysql_fetch_assoc($result))
             { 
  array_push($total2, $myrow['total']);
	}
	$content = array_sum($total2);

nvm. it turns out that there was a sligh little devil hiding screwing it all up

Member Avatar for rajarajan2017

Either you got the result or not?

sorry the code i had was fine. it was that a variable was hiding that over wrote what i had previous. i hate it when i ask for help and then i find what the problem was after

Member Avatar for rajarajan2017

COOL!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.