public function update($table = '', $data = [], $arrayWhere = [], $other = '')
    {
        // if table name is empty
        if (!empty($table)) {
            // check if array data and where array is more then 0
            if (count($data) > 0 && count($arrayWhere) > 0) {
                // parse array data and make a temp array
                $tmp = [];
                foreach ($data as $k => $v) {
                    $tmp[] = "$k = :s_$k";
                }
                // join temp array value with ,
                $sFields = implode(', ', $tmp);
                // delete temp array from memory
                unset($tmp);

                $tmp = [];
                // parse where array and store in temp array
                foreach ($arrayWhere as $k => $v) {
                    $tmp[] = "$k = :s_$k";
                }

                $this->data = $data;
                $this->arrayWhere = $arrayWhere;
                // join where array value with AND operator and create where condition
                $where = implode(' AND ', $tmp);
                // unset temp array
                unset($tmp);
                // make sql query to update
                $this->sql = "UPDATE `$table` SET $sFields WHERE $where $other;";
                // on PDO prepare statement
                $this->STH = $this->prepare($this->sql);
                // bind pdo param for update statement
                $this->_bindPdoNameSpace($data);
                // bind pdo param for where clause
                $this->_bindPdoNameSpace($arrayWhere);
                // try catch block start
                try {
                    // if PDO run
                    if ($this->STH->execute()) {
                        // get affected rows
                        $this->affectedRows = $this->STH->rowCount();
                        // close PDO
                        $this->STH->closeCursor();
                        // return self object
                        return $this;
                    } else {
                        self::error($this->STH->errorInfo());
                    }
                } catch (\PDOException $e) {
                    // get pdo error and pass on error method
                    self::error($e->getMessage() . ': ' . __LINE__);
                } // try catch block end
            } else {
                self::error('update statement not in valid format..');
            }
        } else {
            self::error('Table name not found..');
        }
    }
public function update($table = '', $data = [], $arrayWhere = [], $other = '')
    {
        // if table name is empty
        if (!empty($table)) {
            // check if array data and where array is more then 0
            if (count($data) > 0 && count($arrayWhere) > 0) {
                // parse array data and make a temp array
                $tmp = [];
                foreach ($data as $k => $v) {
                    $tmp[] = "$k = :s_$k";
                }
                // join temp array value with ,
                $sFields = implode(', ', $tmp);
                // delete temp array from memory
                unset($tmp);

                $tmp = [];
                // parse where array and store in temp array
                foreach ($arrayWhere as $k => $v) {
                    $tmp[] = "$k = :s_$k";
                }

                $this->data = $data;
                $this->arrayWhere = $arrayWhere;
                // join where array value with AND operator and create where condition
                $where = implode(' AND ', $tmp);
                // unset temp array
                unset($tmp);
                // make sql query to update
                $this->sql = "UPDATE `$table` SET $sFields WHERE $where $other;";
                // on PDO prepare statement
                $this->STH = $this->prepare($this->sql);
                // bind pdo param for update statement
                $this->_bindPdoNameSpace($data);
                // bind pdo param for where clause
                $this->_bindPdoNameSpace($arrayWhere);
                // try catch block start
                try {
                    // if PDO run
                    if ($this->STH->execute()) {
                        // get affected rows
                        $this->affectedRows = $this->STH->rowCount();
                        // close PDO
                        $this->STH->closeCursor();
                        // return self object
                        return $this;
                    } else {
                        self::error($this->STH->errorInfo());
                    }
                } catch (\PDOException $e) {
                    // get pdo error and pass on error method
                    self::error($e->getMessage() . ': ' . __LINE__);
                } // try catch block end
            } else {
                self::error('update statement not in valid format..');
            }
        } else {
            self::error('Table name not found..');
        }
    }
public function update ( $ table = '' , $ data = [ ] , $ arrayWhere = [ ] , $ other = '' ) { // if table name is empty if ( ! empty ( $ table ) ) { // check if array data and where array is more then 0 if ( count ( $ data ) > 0 && count ( $ arrayWhere ) > 0 ) { // parse array data and make a temp array $ tmp = [ ] ; foreach ( $ data as $ k => $ v ) { $ tmp [ ] = "$k = :s_$k" ; } // join temp array value with , $ sFields = implode ( ', ' , $ tmp ) ; // delete temp array from memory unset ( $ tmp ) ; $ tmp = [ ] ; // parse where array and store in temp array foreach ( $ arrayWhere as $ k => $ v ) { $ tmp [ ] = "$k = :s_$k" ; } $ this -> data = $ data ; $ this -> arrayWhere = $ arrayWhere ; // join where array value with AND operator and create where condition $ where = implode ( ' AND ' , $ tmp ) ; // unset temp array unset ( $ tmp ) ; // make sql query to update $ this -> sql = "UPDATE `$table` SET $sFields WHERE $where $other;" ; // on PDO prepare statement $ this -> STH = $ this -> prepare ( $ this -> sql ) ; // bind pdo param for update statement $ this -> _bindPdoNameSpace ( $ data ) ; // bind pdo param for where clause $ this -> _bindPdoNameSpace ( $ arrayWhere ) ; // try catch block start try { // if PDO run if ( $ this -> STH -> execute ( ) ) { // get affected rows $ this -> affectedRows = $ this -> STH -> rowCount ( ) ; // close PDO $ this -> STH -> closeCursor ( ) ; // return self object return $ this ; } else { self :: error ( $ this -> STH -> errorInfo ( ) ) ; } } catch ( \ PDOException $ e ) { // get pdo error and pass on error method self :: error ( $ e -> getMessage ( ) . ': ' . __LINE__ ) ; } // try catch block end } else { self :: error ( 'update statement not in valid format..' ) ; } } else { self :: error ( 'Table name not found..' ) ; } }
Execute PDO Update Statement
Get No OF Affected Rows updated.

@param string $table
@param array  $data
@param array  $arrayWhere
@param string $other

@return self|void
Execute PDO Update Statement Get No OF Affected Rows updated .