Ver Mensaje Individual
  #1 (permalink)  
Antiguo 10/04/2011, 13:28
memoskpo
 
Fecha de Ingreso: noviembre-2010
Mensajes: 5
Antigüedad: 13 años, 5 meses
Puntos: 0
Exclamación Post relacionados

Hola Tengo una web tipo 2.0 en php (parecida a T!) y tengo un problema al hacer una llamada de "Post Relacionads" no encuentro cual puede ser el error asi qeu recurri a pedir ayuda esto es lo que tengo en related-posts.php+

<?php
// Comprobar si accede directamente
if(!defined($config['define'])) { header('Location: /index.php'); }
// 360 303 303
if($_GET['title'] && $_GET['id']) {
$title = mysql_clean(str_replace('-', ' ', $_GET['title']));
$rq = (substr_count($title, ' ') == 0 ? "SELECT title, id, cat, MATCH(title, message) AGAINST('".$title."') AS score FROM `posts` WHERE (title LIKE '%".$title."%' OR message LIKE '%".$title."%')" : "SELECT *, MATCH(title, message) AGAINST('".$title."') AS score FROM `posts` WHERE MATCH(title, message) AGAINST('".$title."')");
$rq .= " && id != '".mysql_clean($_GET['id'])."' ORDER BY score DESC LIMIT 10";
$rquery = mysql_query($rq);
while($relatedpost = mysql_fetch_array($rquery)) {
$relatedcat = mysql_fetch_array(mysql_query("SELECT urlname, name FROM `categories` WHERE id = '".$relatedpost['cat']."'"));
echo '<li class="categoriaPost '.$relatedcat['urlname'].'"><a href="/posts/'.$relatedcat['name'].'/'.$relatedpost['id'].'/'.url($relatedpost['title']).'.html">'.htmlspecialchars($relatedpost['title']).'</a></li>';
}
} // title
?>

(tengo URL amigables)

En la base de datos tengo las tablas

categories (id, name, urlname)
posts (id, title, cat, message)

y el error que me da es el siguiente:
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home3/memoskpo/public_html/related-posts.php on line 10

y aparentemente tengo todo en la base de datos y hay suficientes post como para relacionarlos, alguiewn tiene idea que puede ser? Desde ya muchas gracias!