Re: unable to update table
Unless I'm mistaken, SELECT SUM() will not return an array.
How about:
Code:
$getsum1=mysql_query('select sum(product) as summ from tempo');
$sumtot=mysql_result($getsum1,0);
$finq=mysql_query('update tempo set percent=(product*100)/'.$sumtot);
Re: unable to update table
That did it! wonderful, thank you.
Actually, i was getting the result [of sum(product)] in array and checked for its presence too, but using mysql_result was the best option (as u suggested).
i making a big mistake in my sql statement, see the difference
your correct way:
PHP Code:
$finq=mysql_query('update tempo set percent=(product*100)/'.$sumtot);
my incorrect way:
PHP Code:
$finq=mysql_query('update tempo set percent=(product*100)/$sumtot');
That made a lot of difference. i should have kept $sumtot out of single quote.
Thanks:bigyello: