Ver Mensaje Individual
  #1 (permalink)  
Antiguo 19/08/2007, 18:45
braiank
 
Fecha de Ingreso: diciembre-2005
Mensajes: 249
Antigüedad: 18 años, 4 meses
Puntos: 0
Noticias relacionadas

Hola, queria hacer un sistema de noticias relacionadas, osea al ver una noticia que te muestre otras noticias de la base de datos que tengan algo que ver con esa noticia que estes viendo.
Yo quiero que por varias palabras del titulo o contenido ya se relacionen pero no logro hacerlo, hice algo asi :

Código PHP:
     $noticias_rel=mysql_query("SELECT * FROM noticias WHERE contenido_noticia LIKE '%".$getnoticia['contenido_noticia']."%'");
     echo 
"
        </table>
     <table width=100% align=left>
      <tr>
       <td class='titulos_tablas' width='50%' align='left' style='font-size:11px;'>> Noticias Relacionadas</td>
       <td class='titulos_tablas' width='50%' align='right' style='font-size:11px;'>> Ultimas 10 Noticias</td>
      </tr>
     "
;
 while (
$row mysql_fetch_array($noticias_rel))
 {
  
$get_date=mysql_fetch_array(mysql_query("SELECT DATE_FORMAT(fechaord, '%d/%m') AS fechaformat, DATE_FORMAT(fechaord, '%Y') AS fechaformat2 FROM noticias WHERE id_noticia='".$row['id_noticia']."'"));
   echo 
"
    <tr><td style='padding-top:2px; padding-bottom:2px; padding-left:2px; border-bottom: solid 1px #9C9C9C;' class='c'>
     <b>"
.$get_date['fechaformat']."</b> > <a href='index.php?titulo=".$nombre."&a=noticia&id=".$row['id_noticia']."' style='font-size:11px;'>".$row['titulo_noticia']."</a>
    </td></tr>
   "
;
 } 
Pero me devuelve solamente la noticia que estoy viendo nomas

Un saludo