$result = mysql_query("SELECT sum(precio) as total FROM temp where id=$ipp"); $total = mysql_result($result,0,'total');