Ver Mensaje Individual
  #2 (permalink)  
Antiguo 28/07/2007, 15:20
Avatar de Raulmmmm
Raulmmmm
 
Fecha de Ingreso: marzo-2007
Ubicación: En otro lugar que tú
Mensajes: 1.549
Antigüedad: 17 años, 1 mes
Puntos: 36
Re: ayuda para resolver contador de visitas

Prueba con esto(no estoy seguro de ello):
Código PHP:
<?PHP
//miro a ver el n&uacute;mero total de campos que hay en la tabla con esa b&uacute;squeda 
$sql "SELECT id,COUNT(*) as rut FROM visitas where rut='$rut'GROUP BY id"
$resmysql_query($sql) or die (mysql_error());
$num_rows mysql_num_rows($res);
//echo $num_rows ."&nbsp;/ Fecha última visita:&nbsp;";

$sqlfecha="select * from visitas where rut='$rut' order by fecha ASC";
$resultado=mysql_query($sqlfecha)or die(mysql_error());
$sqlclientes="SELECT NomEmp from clientes order by NomEmp ASC";
$res2mysql_query($sqlclientes) or die (mysql_error());
while(
$row=mysql_fetch_array($resultado))
{
$fecha .=$row['fecha'];
$rut .=$row['rut'];
}
echo 
"<table class='bodyText1' width='90%' border='0' cellspacing='0' cellpadding='0'>
 <tr>
 <td class='bodyText9' width='50%' height='23'><div align='left'>Nombre Usuario</div></td>
 <td class='bodyText9' width='20%' height='23'><div align='left'>Total Visitas</div></td>
 <td class='bodyText9' width='10%' height='23'><div align='center'>Última visita</div></td>
 </tr>"
;
while(
$row=mysql_fetch_array($res2))
 {
    
$NomEmp=$row['NomEmp'];
    
$rut=$row['rut'];
    
$id=$row['id'];

  echo
"<tr>
 <td><div align='left'>$NomEmp</div></td>
   <td><div align='left'></div></td>
 <td><div align='center'>$fecha</div></td>
 <tr>
<td colspan='3'><div align='center'><img src='ima/rul2.jpg' width='100%' height='12' /></div></td>
  </tr>
</tr>"
;
echo 
$num_rows."&nbsp; / Fecha última visita:&nbsp;".$fecha;
}
echo 
"</table>";
  
?>