Si, lo que dices esta facil :P
ID --------------------- URL ----------------------------- CATEGORIA
1 -----------------
http://www.google.es ------------- Perros
2 -----------------
http://www.google.com ----------- Perros
3 -----------------
http://www.google.com.ar -------- Perros
4 -----------------
http://www.msn.es ------------------ Gatos
5 -----------------
http://www.msn.com ---------------- Gatos
Pues seria esto :
Código PHP:
$categoria = "Perros" ;
$qry = mysql_query("Select URL from linka where categoria='$categoria'") ;
while($dato = mysql_fetch_assoc($qry))
{
$url = $dato['URL'] ;
echo ' <a href="'.$url.'" target=_blank>'.$url.'</a>' ;
}
Te dejo un Enlace a la Funcion mysql_fetch_assoc:
http://es.php.net/manual/es/function...etch-assoc.php
Espero que te ayude :]
^_^
PD,Edited : Para comparar Strings es mejor usar el Like que el = que he puesto yo, aunq yo estoy acostumbrado a usar el = y siempre me ha funcionado :P
;)
PD 2 : Acabo d leer algo de que quieres tener las ultimas primeros, eso se arreglaria poniendo a la select:
order by id DESC:
Código PHP:
$qry = mysql_query("Select URL from linka where categoria='$categoria' order by id DESC") ;
y si solo qres obtener 1, y es la ultima :
Código PHP:
$qry = mysql_query("Select URL from linka where categoria='$categoria' order by id DESC Limit 1") ;