Ver Mensaje Individual
  #5 (permalink)  
Antiguo 25/09/2008, 13:25
Avatar de Carlojas
Carlojas
 
Fecha de Ingreso: junio-2007
Ubicación: Shikasta
Mensajes: 1.272
Antigüedad: 16 años, 11 meses
Puntos: 49
Respuesta: Consulta sobre while ...

Que tal geminiz, basta con aplicar a tu consulta la instrucción SQL DISTINCT

Código PHP:
<?php
include('config.php'); 
echo 
"<table align=right>\n"
$data mysql_query("SELECT DISTINCT categoria FROM producto LIMIT 6") or die("Error en query:".mysql_error() ); 
while(
$row=mysql_fetch_array($data)) 
{ echo 
"<td class=\"navbar_off\" onmouseover=\"this.className = 'navbar_on'\" onmouseout=\"this.className = 'navbar_off'\" onclick=\"window.location = 'categorias.php?cat=$row[0]'\" align=center><li>$row[0]</li></td></tr>"; } 
echo 
'</table>'
mysql_close(); 
?>

Saludos.