public function update( $row_key, $data, $where = array() ) {

		if ( empty( $row_key ) ) {
			return false;
		}

		if ( empty( $where ) ) {
			$where = array( $this->table->get_primary_key() => $row_key );
		}

		$columns = $this->table->get_columns();

		// White list columns
		$data = array_intersect_key( $data, $columns );

		foreach ( $data as $name => $value ) {
			$data[ $name ] = $this->prepare_for_storage( $name, $value );
		}

		$formats      = array_fill( 0, count( $data ), '%s' );
		$where_format = array_fill( 0, count( $where ), '%s' );

		$prev   = $this->wpdb->show_errors( false );
		$result = $this->wpdb->update( $this->table->get_table_name( $this->wpdb ), $data, $where, $formats, $where_format );
		$this->wpdb->show_errors( $prev );

		if ( $this->wpdb->last_error ) {
			throw $this->generate_exception_from_db_error();
		}

		return (bool) $result;
	}
public function update( $row_key, $data, $where = array() ) {

		if ( empty( $row_key ) ) {
			return false;
		}

		if ( empty( $where ) ) {
			$where = array( $this->table->get_primary_key() => $row_key );
		}

		$columns = $this->table->get_columns();

		// White list columns
		$data = array_intersect_key( $data, $columns );

		foreach ( $data as $name => $value ) {
			$data[ $name ] = $this->prepare_for_storage( $name, $value );
		}

		$formats      = array_fill( 0, count( $data ), '%s' );
		$where_format = array_fill( 0, count( $where ), '%s' );

		$prev   = $this->wpdb->show_errors( false );
		$result = $this->wpdb->update( $this->table->get_table_name( $this->wpdb ), $data, $where, $formats, $where_format );
		$this->wpdb->show_errors( $prev );

		if ( $this->wpdb->last_error ) {
			throw $this->generate_exception_from_db_error();
		}

		return (bool) $result;
	}
public function update ( $ row_key , $ data , $ where = array ( ) ) { if ( empty ( $ row_key ) ) { return false ; } if ( empty ( $ where ) ) { $ where = array ( $ this -> table -> get_primary_key ( ) => $ row_key ) ; } $ columns = $ this -> table -> get_columns ( ) ; // White list columns $ data = array_intersect_key ( $ data , $ columns ) ; foreach ( $ data as $ name => $ value ) { $ data [ $ name ] = $ this -> prepare_for_storage ( $ name , $ value ) ; } $ formats = array_fill ( 0 , count ( $ data ) , '%s' ) ; $ where_format = array_fill ( 0 , count ( $ where ) , '%s' ) ; $ prev = $ this -> wpdb -> show_errors ( false ) ; $ result = $ this -> wpdb -> update ( $ this -> table -> get_table_name ( $ this -> wpdb ) , $ data , $ where , $ formats , $ where_format ) ; $ this -> wpdb -> show_errors ( $ prev ) ; if ( $ this -> wpdb -> last_error ) { throw $ this -> generate_exception_from_db_error ( ) ; } return ( bool ) $ result ; }
Update a row

@since 1.0

@param string $row_key
@param array  $data
@param array  $where

@return  bool

@throws Exception
Update a row