<?php
 
 require ("conecta.php");
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Documento sin t&iacute;tulo</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body>
<table>
<?php
 $sql="select * from m07001;";
 $res=mysql_query($sql,$con);
 while ($fila=mysql_fetch_row($res)){
 $cod=$fila[0];
 $glosa=$fila[3];
 //echo "<td>". $cod . "</td>";
 //echo "<td>". $glosa . "</td>";
 //echo "<td>". $costo . "</td>";
 //echo "<td>". $pre . "</td>";
 //echo "<td></td>";
 //echo "<td></td>";
 //echo "<td></td>";
 //echo "</tr>";
 $sqlb="select * from m07005 where cod_interno='$cod';";
 $resb=mysql_query($sqlb,$con);// or die(mysql_error());
 $fil=mysql_num_rows($resb);
 if ($fil==0){
   $cont++;
  $sqlgra="insert into m07005 (cod_interno,stock,costo_contable) values ('$cod','0','0' );";
  $resg=mysql_query($sqlgra,$con);// or die(mysql_error());
  
  }
  
}
echo $cont ."<br>";
?>
</table>
<?php
 //odbc_close($cono);
 mysql_close($con);
 ?>
</body>
</html>
