Increase field value by 1 problem

From: Date: Tue, 21 Aug 2001 07:06:57 +0000
Subject: Increase field value by 1 problem
Groups: php.general 
Request: Send a blank email to php-general+get-63567@lists.php.net to get a copy of this message
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?

« previous php.general (#63567) next »