Hi good people,
When should i call mysqli::close ? Should I call $stmt->close() at the end
of the method(below) . Or should I call it after every condition ensuring
that I close the database connection even if the process fails at some
stage e.g bind param
public function function_name($id,$new_id ){
$query = "UPDATE TABLE SET name = ? WHERE field = ? ";
if($stmt=$this->prepare($query)){
if($stmt->bind_param("is", $id, $new_id)){
if($stmt->execute()){
}else{//Could not execute the prepared statement
$message = "Could not execute the prepared statement";
}
}else{//Could not bind the parameters
$message = "Could not bind the parameters";
}
}else{
$message = "Could not prepare the statement";
}
return $message
}
Kind regards
Albert Kamau
--------------------------------------------------------------------
Saf : 0720550742