Welcome Guest, Not a member yet? Register   Sign In
bug: method was executed twice
#1

[eluser]Unknown[/eluser]
The following is a partial code of my program. It count the page view.
But, it seem like the method was executed twice.
So, the count view were 0, 2, 4, 6, 8, 10 ... and so on

Code:
class Blog extends Controller{

function Blog(){
parent::Controller();
}

function view($id=-1){

$this->load->database();
$result = mysql_query("UPDATE mytable SET num_view = num_view + 1 WHERE id = '$id'");
            
}
}

When i remove the sql statement. the counter do nothing. So, it means that the method was executed twice. Is it a bug of the CI.

Sorry, I found the problem. It came from the url that can mislead to execute the function twice.


Messages In This Thread
bug: method was executed twice - by El Forum - 11-02-2007, 02:55 AM
bug: method was executed twice - by El Forum - 11-03-2007, 11:07 AM
bug: method was executed twice - by El Forum - 11-03-2007, 12:54 PM
bug: method was executed twice - by El Forum - 11-05-2007, 04:06 PM



Theme © iAndrew 2016 - Forum software by © MyBB