Ver Mensaje Individual
  #1 (permalink)  
Antiguo 24/03/2011, 05:27
jokin82
 
Fecha de Ingreso: octubre-2005
Mensajes: 42
Antigüedad: 18 años, 6 meses
Puntos: 0
Contar registros sin importar el select distinct

Hola.

Es posible contar el número de registros totales aunque haya hecho ya una consulta con select distinct? O al menos hacer 2 consultas simultáneamente?

Con el código de abajo sólo me muestra 1 registro en $total.

Código:
$sql = "select distinct city from sho where city like 'M%'";
$result = mysql_query($sql,$db_con);
$total = mysql_num_rows($result);
while($row = mysql_fetch_array($result))
{ 
echo '<tr>
<td><a href=rest.php?city='.urlencode($row["city"]).'>'.$row["city"].'</a> <em><strong>'.$total.'</strong></em></td>
</tr>';
}
mysql_free_result($result);
?>
__________________
- Productos islandeses desde Islandia
- News from Spain in English Spain news