Ver Mensaje Individual
  #3 (permalink)  
Antiguo 29/01/2008, 07:01
Avatar de eulloa
eulloa
 
Fecha de Ingreso: octubre-2007
Ubicación: Donde caiga la noche, si mi hijo me deja
Mensajes: 691
Antigüedad: 17 años, 4 meses
Puntos: 5
Problemas con COUNT()

Tengo el siguiente código:
for($i=1;$i<3;$i++){
$select=mysql_query("SELECT DISTINCT(curso),carrera FROM ISP where curso like '$i'");

while($file=mysql_fetch_array($select)){
?>
<tr>
<td bgcolor=#F3F4F2 bordercolor=#000099><b><? echo $file[curso];?></b></td>
<td bgcolor=#F3F4F2 bordercolor=#000099><b><? echo $file[carrera];?></b></td>

<?

?>

<?

for($j=0;$j<6;$j++){
$select_1=mysql_query("SELECT curso,carrera,AnoEstudio,Count(carrera) AS Total
FROM ISP where curso like '$file[curso]' AND AnoEstudio='$j' AND carrera='$file[carrera]'
order by carrera");
while($row=mysql_fetch_array($select_1)){

?>

<td bgcolor=#F3F4F2 bordercolor=#000099><b><?echo $row[Total]; $total+=$row[Total];?></b></td><?}

?>

<?
}
?>
<td bgcolor=#F3F4F2 bordercolor=#000099><b><? echo $total; $total=0;?></b></td>

Me funciona bien, pero cuando encuentra algún valor igual a 0, imprime los siguientes valores donde debería dejar el 0. Es decir, si 1 y 2 don 0, pues imprimirá 3,4 y 5 empezando por el 1 y 2, me corre el total también
¿Alguien me puede ayudar?