public function insert($fields) {
        // Create temporary variables for 
        // tokenized parameter
        $_tmp_fields = [];
        $_tmp_values = [];
        
        if (is_array($fields)) {
            foreach ($fields as $key => $value) {
                array_push($_tmp_fields, $key);
                
                if (is_string($value)) {
                    array_push($_tmp_values, '\'' . addslashes($value) . '\'');
                } else {
                    array_push($_tmp_values, $value);
                }
            }
            
            $this->_fields = implode($_tmp_fields, ', ');
            $this->_values = implode($_tmp_values, ', ');
        } else {
            return false;
        }
        
        $sql_query = 'INSERT INTO ' . $this->_table . 
                     '(' . $this->_fields . ')' .
                     ' VALUES(' . $this->_values . ')';
                     
        // Set the query
        $this->_sql_query = $sql_query;
        
        // Execute query
        return $this;
    }
public function insert($fields) {
        // Create temporary variables for 
        // tokenized parameter
        $_tmp_fields = [];
        $_tmp_values = [];
        
        if (is_array($fields)) {
            foreach ($fields as $key => $value) {
                array_push($_tmp_fields, $key);
                
                if (is_string($value)) {
                    array_push($_tmp_values, '\'' . addslashes($value) . '\'');
                } else {
                    array_push($_tmp_values, $value);
                }
            }
            
            $this->_fields = implode($_tmp_fields, ', ');
            $this->_values = implode($_tmp_values, ', ');
        } else {
            return false;
        }
        
        $sql_query = 'INSERT INTO ' . $this->_table . 
                     '(' . $this->_fields . ')' .
                     ' VALUES(' . $this->_values . ')';
                     
        // Set the query
        $this->_sql_query = $sql_query;
        
        // Execute query
        return $this;
    }
public function insert ( $ fields ) { // Create temporary variables for 
 // tokenized parameter
 $ _tmp_fields = [ ] ; $ _tmp_values = [ ] ; if ( is_array ( $ fields ) ) { foreach ( $ fields as $ key => $ value ) { array_push ( $ _tmp_fields , $ key ) ; if ( is_string ( $ value ) ) { array_push ( $ _tmp_values , '\'' . addslashes ( $ value ) . '\'' ) ; } else { array_push ( $ _tmp_values , $ value ) ; } } $ this -> _fields = implode ( $ _tmp_fields , ', ' ) ; $ this -> _values = implode ( $ _tmp_values , ', ' ) ; } else { return false ; } $ sql_query = 'INSERT INTO ' . $ this -> _table . '(' . $ this -> _fields . ')' . ' VALUES(' . $ this -> _values . ')' ; // Set the query
 $ this -> _sql_query = $ sql_query ; // Execute query
 return $ this ; }
Insert data to table

@param   array   $fields Fields to put in data

@return  mixed   Returns $this when insert succeed and false on failure
Insert data to table