I have this code for inserting in DB:
    public function insert($table,$parameters=array()){
    $param="";
    $val=array();
    $insert= str_replace(':', '', array_keys($parameters)); //remove :
    //Build Query
    $query="INSERT INTO {$this->dbinfo["prefix"]}$table";
    if(is_array($insert)){
        $query.=' (`'.implode("`,`",$insert).'`) VALUES (:'.implode(', :',$insert).')';
        $result = $this->db->prepare($query);
        foreach($parameters as $key=>$param) {
          $result->bindParam($key, $param);
        }
    }
    $result->execute();
    if($err=$this->error_message($this->db->errorInfo())) {
        $this->query=strtr($query,$parameters);
        $this->db_error=$err;
        exit;
    }
    ++$this->num_queries;
    $last_id = FALSE;
    $last_id = $this->db->lastInsertId();
return $last_id;        
}
Error handling:
private function error_message($error){
    if(!empty($error[2])){
        return $error[2];
    }
    return FALSE;
}
The call sample can look like:
$this->db->insert("log_url",array(":name"=>"url",":urlid"=>15,":type"=>0));
The example above insert in the database row filled with the last value, in this case 0. When I delete the type, it fill all with 15. Etc... Somewhere in insert function is mistake, but i cannot find it.
Any information helps. Thank you.
