$sumatotalpedido = mysql_query("SELECT sum(total) AS suma FROM ...$rowsumas = mysql_fetch_array($sumatotalpedido);$totalsuma = $rowsumas['suma'];