i just realize that that was not the problem, i actually have this now
<?php
include("config.php");
$link=Conectarse();
$result=mysql_query("select * from movimientos");
$sql = "SELECT SUM(cantidad) - (SELECT SUM(cantidad) FROM movimientos WHERE tipo = 1) AS total FROM movimientos WHERE tipo = 0";
$result = mysql_query($sql);
$total = mysql_result($result, 0);
?>
so i can just show results for either $result or $total but not both :S
$result have this above
<?php
while($row = mysql_fetch_array($result)){
code
}