Ver Mensaje Individual
  #3 (permalink)  
Antiguo 10/04/2008, 05:48
Avatar de ZiTAL
ZiTAL
 
Fecha de Ingreso: marzo-2004
Ubicación: Bermio (Bizkaia)
Mensajes: 1.545
Antigüedad: 20 años, 2 meses
Puntos: 62
De acuerdo Re: count en php no cuenta

Es que lo has planteado mal, el count te cuenta los registros que tiene esa variable, lo que deberias hacer es:
Código PHP:
$cont=0;
  
$consulta1="select * from op_operaciones where IDOFICINA = ".$_SESSION['idoficina'];
  
$query1 mysql_query($consulta1,$conexion);
  while(
$row=mysql_fetch_array($query1)){
      if(
$row['ESTADO_OP'] == 'PENDIENTE FIRMA'){
        
$cont++
      }
  } 
echo 
$cont
o hacer mejor la select:
Código PHP:
  $consulta1="select count(*) from op_operaciones where IDOFICINA = ".$_SESSION['idoficina']." and ESTADO_OP like 'PENDIENTE FIRMA'";
 
$query1 mysql_query($consulta1,$conexion);
echo 
$count=mysql_result($query1,0,0); 
__________________
http://zital.no-ip.org
____________________

Euskerie ahuen eta bijotzan