Hello
I have Following code
function updateHitCounter($id,$PHPSESSID,$type){
$flag=$this->validateSession($PHPSESSID);
if($flag==1){
include("admin/config.inc.php");
$connection = mysql_connect("$host","$username","$password");
if ($connection == false){
echo mysql_errno().": ".mysql_error()."<BR>";
exit;
}
if($type=="out") $query = "select * from sites where id='$id'";
elseif($type=="in") $query = "select * from sites where id='$id'";
$result = mysql_db_query ("$dbase", $query);
if ($result){
$numOfRows = mysql_num_rows ($result);
$hitsIn= mysql_result ($result, $i, "hitsOut");
$hitsOut= mysql_result ($result, $i, "hitsIn");
}else{
echo mysql_errno().": ".mysql_error()."<BR>";
}
if($type=="out"){
$hits=$hitsOut;
}else{
$hits=$hitsIn;
}
$hits++;
$query = "UPDATE sites SET hitsOut ='$hits' WHERE id='$id'";
$result = mysql_db_query ("$dbase", $query);
if (!$result){
echo mysql_errno().": ".mysql_error()."<BR>";
}
mysql_close ();
}
}
When I run it i get this error: Warning: Unable to jump to row 0 on MySQL result index 4 in c:\program files\apache group\apache\htdocs\phptopsites\top100.php on line 222
Guys is there anyway i can avoid it?
Thank you Vey much
I have Following code
function updateHitCounter($id,$PHPSESSID,$type){
$flag=$this->validateSession($PHPSESSID);
if($flag==1){
include("admin/config.inc.php");
$connection = mysql_connect("$host","$username","$password");
if ($connection == false){
echo mysql_errno().": ".mysql_error()."<BR>";
exit;
}
if($type=="out") $query = "select * from sites where id='$id'";
elseif($type=="in") $query = "select * from sites where id='$id'";
$result = mysql_db_query ("$dbase", $query);
if ($result){
$numOfRows = mysql_num_rows ($result);
$hitsIn= mysql_result ($result, $i, "hitsOut");
$hitsOut= mysql_result ($result, $i, "hitsIn");
}else{
echo mysql_errno().": ".mysql_error()."<BR>";
}
if($type=="out"){
$hits=$hitsOut;
}else{
$hits=$hitsIn;
}
$hits++;
$query = "UPDATE sites SET hitsOut ='$hits' WHERE id='$id'";
$result = mysql_db_query ("$dbase", $query);
if (!$result){
echo mysql_errno().": ".mysql_error()."<BR>";
}
mysql_close ();
}
}
When I run it i get this error: Warning: Unable to jump to row 0 on MySQL result index 4 in c:\program files\apache group\apache\htdocs\phptopsites\top100.php on line 222
Guys is there anyway i can avoid it?
Thank you Vey much