Ver Mensaje Individual
  #2 (permalink)  
Antiguo 22/10/2011, 09:13
Avatar de Patriarka
Patriarka
 
Fecha de Ingreso: enero-2011
Ubicación: Moreno, Buenos Aires, Argentina
Mensajes: 2.851
Antigüedad: 13 años, 3 meses
Puntos: 288
Respuesta: Poner lista de categorias con sus repectivos url

wueno eso es muy facil:
Código PHP:
Ver original
  1. $query = "SELECT * FROM `categorias` ORDER BY valor ASC";
  2. $resultado = mysql_query ($query, $dbConn);
  3. while ( $row = mysql_fetch_object ($resultado)) {
  4. ?>
  5.     <a href="noticias.php?id_categoria=<?php echo $row->idCategoria; ?>"><?php echo $row->nombreCategoria; ?></a>
  6. <?php  
  7. }
  8.  
  9. [B]noticias.php[/B]
  10. $id_categoria=isset($_GET['id_categoria']) ? $_GET['id_categoria'] : 0; //si por algun motivo no existe la variable $_GET['id_categoria'] se asigo 0
  11.  
  12. $query = "SELECT * FROM `noticias` ORDER BY idNoticia WHERE ID_CATEGORIA =  '$id_categoria' DESC LIMIT 10";
  13. $resultado = mysql_query ($query, $dbConn);
  14. while ( $row = mysql_fetch_object ($resultado)) {
  15.     echo $row->titulo_noticia;
  16. }