Hello,
I have a Joomla page where I am getting this error…I have seen this error in a number of places and also searched a number of forums…but was unable to get a solution…
Here is the error…
Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/kids2/public_html/updated/templates/kidsfirstsports/index.php on line 8
Warning: mysql_free_result(): supplied argument is not a valid MySQL result resource in /home/kids2/public_html/updated/templates/kidsfirstsports/index.php on line 21
Here is the code of this page…
<?php defined( '_VALID_MOS' ) or die( 'Direct Access to this location is not allowed.' );
function GetRecords($query,$parm)
{
$query=$query.$parm;
$rscat=mysql_query($query);
$ResArry=array();
$recordCounter = 0;
if (mysql_num_rows($rscat) > 0)
{
$k = mysql_num_fields($rscat);
while ($recordRow = mysql_fetch_array($rscat))
{
for($j=0;$j<$k;$j++)
{
$fieldname = mysql_field_name($rscat, $j);
$ResArry[$recordCounter][strtoupper($fieldname)]=$recordRow[$fieldname];
}
$recordCounter ++;
}
}
mysql_free_result($rscat);
return $ResArry;
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<?php $iso = split( '=', _ISO );
echo '<?xml version="1.0" encoding="'. $iso[1] .'"?' .'>';
?>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; <?php echo _ISO; ?>" />
<?php mosShowHead(); ?>
<?php
if ( $my->id ) {
initEditor();
}
if ((mosCountModules( 'user1' )) && (mosCountModules( 'user2' ))) {
//if both modules are loaded, we need a 50%-layout for them
$usera = 'user1';
$userb = 'user2';
} else if ((mosCountModules( 'user1' )) || (mosCountModules( 'user2' ))) {
// if only one, then 100% no matter which one.
$usera = 'user3';
$userb = 'user3';
}
?>
<meta http-equiv="Content-Type" content="text/html; <?php echo _ISO; ?>" />
<link href="<?php echo $mosConfig_live_site; ?>/templates/kidsfirstsports/css/template_css.css" rel="stylesheet" type="text/css" />
<link href="<?php echo $mosConfig_live_site; ?>/templates/kidsfirstsports/css/css_color_white.css" rel="stylesheet" type="text/css" />
</head>
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<table width="780" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td colspan="2">
<table width="100%" border="0" cellspacing="1" cellpadding="1">
<tr>
<td width="39%" align="left" valign="top">
<a href="index.php?option=com_content&task=view&id=1&Itemid=135">
<?php echo '<img src="' .$mosConfig_live_site. '/templates/' .$GLOBALS['cur_template']. '/images/logo.gif" border="0" width="263" height="133" alt="logo"/>'; ?> </a> </td>
<td width="61%">
<?php
if (mosCountModules( "user9" )) {
?>
<?php mosLoadModules ( 'user9',-1); ?> <?php
}
?> </td>
</tr>
</table>
</td>
</tr>
<tr>
<td colspan="2"align="center" valign="top">
<?php
if (mosCountModules( "top" )) {
?>
<?php mosLoadModules ( 'top',-1); ?>
<?php
}
?>
</td>
</tr>
<tr>
<td colspan="2" align="center">
<!-- ?php //if (mosCountModules( "user3" )) { ? >< ?php //mosLoadModules ( 'user3',-1); ?>< ?php //} ? -->
<?php
include("topmenu.php");
/*if (mosCountModules( "left" ))
{
mosLoadModules ( 'left',-1);
}*/
?>
</td>
</tr>
<tr>
<td colspan="2" class="space2px"> </td>
</tr>
<tr valign="top">
<td valign="top" align="left">
<?php
include("categorylist.php");
/*if (mosCountModules( "left" ))
{
mosLoadModules ( 'left',-1);
}*/
?>
<p class="t14ArialBoldBlue"> </p>
</td>
<td valign="top" align="left">
<?php
if(isset($_REQUEST['page']))
{
if($_REQUEST['page']=="reg")
include("templates/kidsfirstsports/registration.php");
elseif($_REQUEST['page']=="verify")
include("templates/kidsfirstsports/verify.php");
elseif($_REQUEST['page']=="creditcard")
include("templates/kidsfirstsports/creditcard.php");
elseif($_REQUEST['page']=="bankcheck")
include("templates/kidsfirstsports/bankcheck.php");
elseif($_REQUEST['page']=="ver_info")
include("templates/kidsfirstsports/verify_info.php");
elseif($_REQUEST['page']=="authtransaction")
include("templates/kidsfirstsports/authtransaction.php");
}
else
mosMainBody();
?></td>
</tr>
<tr>
<td width="183"> </td>
<td width="597">
<?php
if (mosCountModules( "user8" )) {
?>
<?php mosLoadModules ( 'user8',1); ?>
<?php
}else{?>
<table align="center" cellspacing="0" cellpadding="0" width="100%">
<tr>
<td><hr size="5" color="#FF9900"></td>
</tr>
<tr>
<td class="t12boldgreenarial"><div align="center">***Kids First Certified ***NYSCA Certified ***ASEP Certified ***Red Cross CPR Certified<br />
<br />
<br />
</div></td>
</tr>
<tr>
<td height="30">
<div align="center"><span class="txt16boldgreenarial">© Kids First Sports Safety, Inc.</span> <span class="txt16boldbluearial">All Rights Reserved.</span></div></td>
</tr>
</table>
<?}?>
</td>
</tr>
</table>
</body>
</html>