CLASS_MYSQLI::insert PHP Method

insert() public method

public insert ( $table, $data )
    function insert($table, $data)
    {
        $sql = "INSERT INTO `" . $table . "` SET ";
        $values = array();
        foreach ($data as $key => $value) {
            $values[] = "`" . $key . "`='" . $value . "'";
        }
        $sql .= implode(",", $values);
        $this->db_rs = $this->query($sql);
        if (!$this->db_rs) {
            return false;
        }
        return $this->insert_id();
    }