Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in archivo.php in line XX
Esto solo al poner el codigo de integración del foro, se lo quito y todo bien, me interesa, para que solo usuarios registrados puedan comentar la noticia.
Código:
//**********CODIGO DE INTEGRACION phpBB
<?
$volver="..$_SERVER[PHP_SELF]";
define('IN_PHPBB', true);
$phpbb_root_path = '../comunidad/';
include($phpbb_root_path . 'extension.inc');
include($phpbb_root_path . 'common.'.$phpEx);
$userdata = session_pagestart($user_ip, PAGE_INDEX);
init_userprefs($userdata);
global $db, $board_config;
global $HTTP_COOKIE_VARS, $HTTP_GET_VARS, $SID;
$cookiename = $board_config['cookie_name'];
$cookiepath = $board_config['cookie_path'];
$cookiedomain = $board_config['cookie_domain'];
$cookiesecure = $board_config['cookie_secure'];
if ( !(isset($HTTP_COOKIE_VARS[$cookiename . '_sid']) || isset($HTTP_COOKIE_VARS[$cookiename . '_data'])) )
{
output_add_rewrite_var('sid', $userdata['session_id']);
}
$log_in_out=( $userdata['session_logged_in'] ) ? ('<a href="'.$phpbb_root_path.'login.'.$phpEx.'?logout=true&sid=' . $userdata['session_id'].'&redirect='.$volver.'" class="ink_menu">Logout ['.$userdata['username'].']</a>') : ('');
?>
//********* CODIGO PARA MOSTRAR LA NOTICIA
<? if (!$skip AND !$print) { include "header.php"; } ?>
<?
if ($print)
{
echo "<body onLoad=\"window.print()\">";
}
include ("admin/db.php");
include ("admin/set_inc.php");
include ("admin/language/$lang");
settype($artid,"integer");
$sql = "SELECT * FROM article_news,author_news where author_news.userid = article_news.authorid AND id = '$artid'";
$result = mysql_query($sql);
$num_res = mysql_num_rows($result);
for ($i=0; $i<$num_res; $i++)
{
$myrow = mysql_fetch_array($result);
$id = $myrow["id"];
$catid = $myrow["catid"];
$title = $myrow["title"];
$date = $myrow["date"];
$date_changed = $myrow["date"];
$authorid = $myrow["authorid"];
$intro = $myrow["intro"];
$body = $myrow["body"];
$status = $myrow["status"];
$count = $myrow["count"];
$votes = $myrow["votes"];
$grade = $myrow["grade"];
$fname = $myrow["fname"];
$lname = $myrow["lname"];
$userid = $myrow["userid"];
$email = $myrow["email"];
$show_html = $myrow["show_html"];
$year=substr($myrow[date],0,4);
$month=substr($myrow[date],4,2);
$day=substr($myrow[date],6,2);
$tid1 = "$day.$month.$year";
$year2=substr($myrow[date_changed],0,4);
$month2=substr($myrow[date_changed],4,2);
$day2=substr($myrow[date_changed],6,2);
$tid2 = "$day2.$month2.$year2";
$code_table_start = "<table class=\"code\" borderColorDark=\"#000000\"
cellPadding=\"2\" width=\"100%\" bgColor=\"#e4e4fc\" borderColorLight=\"#ffffff\"
border=\"1\"><tr><td width=\"100%\">";
$code_table_end = "</td></tr></table>";
}
$sql = "SELECT * FROM cat_news where id = $catid";
$result = mysql_query($sql);
//********* AQUI ME MANDA EL ERROR
$num_res = mysql_num_rows($result);
for ($i=0; $i<$num_res; $i++)
{
$myrow = mysql_fetch_array($result);
$catname = $myrow["catname"];
$id = $myrow["id"];
}
print "<!-- TEMPLATE FILE -->";
$filename = "admin/templates/art.html";
$fd = fopen ($filename, "r");
$file= fread ($fd, filesize ($filename));
$file = str_replace("{ID}", "$id", $file);
$file = str_replace("{CATNAME}", "$catname", $file);
$file = str_replace("{TITLE}", "$title", $file);
$file = str_replace("{EMAIL}", "$email", $file);
$file = str_replace("{FNAME}", "$fname", $file);
$file = str_replace("{LNAME}", "$lname", $file);
$file = str_replace("{DATE_CHANGED}", "$date_changed", $file);
$file = str_replace("{ARTID}", "$artid", $file);
$file = str_replace("{INTRO}", "$intro", $file);
$file = str_replace("{TID1}", "$tid1", $file);
$file = str_replace("{TID2}", "$tid2", $file);
$file = str_replace("{BODY}", "$body", $file);
$file = str_replace("{LA_BY}", "$la_by", $file);
$file = str_replace("{LA_CHANGED}", "$la_changed", $file);
$file = str_replace("{LA_NEWS}", "$la_news", $file);
$file = str_replace("{LA_PRINT}", "$la_print", $file);
$file = str_replace("{LA_RATE_THIS}", "$la_rate_this", $file);
$file = str_replace("{LA_TELLAFRIEND}", "$la_tellafriend", $file);
echo $file;
print "<!-- // TEMPLATE FILE -->";
$sql = "UPDATE article_news set count = count+1 where id = $artid;";
$result = mysql_query($sql);
?>
<?php
if( $userdata [ 'session_logged_in' ])
{
print "Registrado";
}
else
{
print "Visitante";
}
?>
<? if (!$skip AND !$print) { include "footer.php"; } ?>

