need help with PHP/MySQL

From: Date: Tue, 21 Nov 2000 04:28:15 +0000
Subject: need help with PHP/MySQL
Groups: php.general 
Request: Send a blank email to php-general+get-26390@lists.php.net to get a copy of this message
oks, this code works for what i was looking for : $mysql = mysql_connect("host", "user", "pass"); mysql_select_db(teste); $sqlquery = "SELECT * FROM preco"; if ($resultset = mysql_query($sqlquery, $mysql)) { echo "<TABLE>"; while ($row = mysql_fetch_array($resultset)) { /* Remove R$ from Preco field */ $fullprice = ($row[preco]); $price = substr ("$fullprice", 3); $totalprice += ($price); } echo "<TR><TD>Total:</TD>"."<TD>".sprintf('%0.2f', $totalprice)."</TD>"."</TABLE>"; } but this code just calculate the sum fom one row .. how can i calculate the all rows from a table ... thanks GS

« previous php.general (#26390) next »