src/DB/PDO/TableWriter.php
public function updateByConditions( $data = array(), $conditions = array(), $stripTags = FALSE ){
		if( !( is_array( $data ) && $data ) )
			throw new \InvalidArgumentException( 'Data for update must be an array and have atleast 1 pair' );
		if( !( is_array( $conditions ) && $conditions ) )
			throw new \InvalidArgumentException( 'Conditions for update must be an array and have atleast 1 pair' );

		$updates	= array();
		$conditions	= $this->getConditionQuery( $conditions, FALSE, FALSE, FALSE );					//  render WHERE conditions, uncursored, without functions
		foreach( $this->columns as $column ){
			if( isset( $data[$column] ) ){
				if( $stripTags )
					$data[$column]	= strip_tags( $data[$column] );
				if( $data[$column] == 'on' )
					$data[$column] = 1;
				$data[$column]	= $this->secureValue( $data[$column] );
				$updates[] = '`'.$column.'`='.$data[$column];
			}
		}
		if( sizeof( $updates ) ){
			$updates	= implode( ', ', $updates );
			$query		= 'UPDATE '.$this->getTableName().' SET '.$updates.' WHERE '.$conditions;
			$result		= $this->dbc->exec( $query );
			return $result;
		}
	}
public function updateByConditions( $data = array(), $conditions = array(), $stripTags = FALSE ){
		if( !( is_array( $data ) && $data ) )
			throw new \InvalidArgumentException( 'Data for update must be an array and have atleast 1 pair' );
		if( !( is_array( $conditions ) && $conditions ) )
			throw new \InvalidArgumentException( 'Conditions for update must be an array and have atleast 1 pair' );

		$updates	= array();
		$conditions	= $this->getConditionQuery( $conditions, FALSE, FALSE, FALSE );					//  render WHERE conditions, uncursored, without functions
		foreach( $this->columns as $column ){
			if( isset( $data[$column] ) ){
				if( $stripTags )
					$data[$column]	= strip_tags( $data[$column] );
				if( $data[$column] == 'on' )
					$data[$column] = 1;
				$data[$column]	= $this->secureValue( $data[$column] );
				$updates[] = '`'.$column.'`='.$data[$column];
			}
		}
		if( sizeof( $updates ) ){
			$updates	= implode( ', ', $updates );
			$query		= 'UPDATE '.$this->getTableName().' SET '.$updates.' WHERE '.$conditions;
			$result		= $this->dbc->exec( $query );
			return $result;
		}
	}
public function updateByConditions ( $ data = array ( ) , $ conditions = array ( ) , $ stripTags = FALSE ) { if ( ! ( is_array ( $ data ) && $ data ) ) throw new \ InvalidArgumentException ( 'Data for update must be an array and have atleast 1 pair' ) ; if ( ! ( is_array ( $ conditions ) && $ conditions ) ) throw new \ InvalidArgumentException ( 'Conditions for update must be an array and have atleast 1 pair' ) ; $ updates = array ( ) ; $ conditions = $ this -> getConditionQuery ( $ conditions , FALSE , FALSE , FALSE ) ; //  render WHERE conditions, uncursored, without functions foreach ( $ this -> columns as $ column ) { if ( isset ( $ data [ $ column ] ) ) { if ( $ stripTags ) $ data [ $ column ] = strip_tags ( $ data [ $ column ] ) ; if ( $ data [ $ column ] == 'on' ) $ data [ $ column ] = 1 ; $ data [ $ column ] = $ this -> secureValue ( $ data [ $ column ] ) ; $ updates [ ] = '`' . $ column . '`=' . $ data [ $ column ] ; } } if ( sizeof ( $ updates ) ) { $ updates = implode ( ', ' , $ updates ) ; $ query = 'UPDATE ' . $ this -> getTableName ( ) . ' SET ' . $ updates . ' WHERE ' . $ conditions ; $ result = $ this -> dbc -> exec ( $ query ) ; return $ result ; } }
Updates data in table where conditions are given for.
@access		public
@param		array		$data			Array of data to store
@param		array		$conditions		Array of condition pairs
@param		bool		$stripTags		Flag: strip HTML tags from values
@return		bool
Updates data in table where conditions are given for .