Ver Mensaje Individual
  #6 (permalink)  
Antiguo 01/09/2014, 10:18
Avatar de secretcode
secretcode
 
Fecha de Ingreso: enero-2014
Mensajes: 16
Antigüedad: 10 años, 3 meses
Puntos: 0
Respuesta: Titulo dinamico

He hecho lo siguiente y me funciona el titulo pero el resto de la pagina no me carga los datos de mysql.

Código PHP:
Ver original
  1. <?php require_once('conexion.php');
  2.     $id_noticia = $_GET['id_noticia'];
  3.     $query = mysql_query("select * from noticias where id_noticia = $id_noticia");
  4. ?>
  5.  
  6. <!DOCTYPE html>
  7. <html lang="en">
  8. <head>
  9.     <meta charset="UTF-8">
  10.     <title>
  11.         <?php
  12.             while ($titulo = mysql_fetch_assoc($query)) {
  13.                 echo $titulo['titulo'];
  14.             }
  15.         ?>
  16.     </title>


Este es el codigo completo:

Código PHP:
Ver original
  1. <?php require_once('conexion.php');
  2.     $id_noticia = $_GET['id_noticia'];
  3.     $query = mysql_query("select * from noticias where id_noticia = $id_noticia");
  4. ?>
  5.  
  6. <!DOCTYPE html>
  7. <html lang="en">
  8. <head>
  9.     <meta charset="UTF-8">
  10.     <title>
  11.         <?php
  12.             while ($titulo = mysql_fetch_assoc($query)) {
  13.                 echo $titulo['titulo'];
  14.             }
  15.         ?>
  16.     </title>
  17. </head>
  18. <body>
  19.     <div class="wrap">
  20.         <?php while ($noticia = mysql_fetch_assoc($query)) { ?>
  21.         <h1 class="titulo_pagina"><?php echo $noticia['titulo'];?></h1>
  22.             <section class="noticias">
  23.                     <div class="noticia">
  24.                         <p class="fecha_hora">Publicado el: <?php echo $noticia['fecha'];?> a las: <?php echo $noticia['hora'];?></p>
  25.                         <p class="articulo"><?php echo $noticia['texto'];?></p>
  26.                     </div>
  27.             </section>
  28.         <?php }?>
  29.     </div>
  30. </body>