public function updateObject($table, &$object, $key) {

		$sets		= array();
		$where		= array();
		$fieldVal	= array();
		$condVal	= array();

		// set table key and values on where conditions
		foreach (get_object_vars($key) as $field => $value) {

			$where[] = $field . ' = ?';
			$condVal[] = $value;

		}

		// set new row values
		foreach (get_object_vars($object) as $field => $value) {
				
			if (is_null($value)) {
				$sets[] = '`' . $field . '` = NULL';
			} else {
				$sets[] = '`' . $field . '` = ?';
				$fieldVal[] = $value;
			}

		}

		// create one list of values to bind
		$values = array_merge($fieldVal, $condVal);

		if (count($sets) and count($where)) {

			// build the SQL query
			$query =
				'UPDATE `' . $table . '`' .
				' SET ' . implode(', ', $sets) .
				' WHERE ' . implode(' AND ', $where);		

			// execute the SQL query
			$res = $this->exec($query, $values);

		} else {
			
			$res = 0;
			
		}
		
		return $res;
		
	}
public function updateObject($table, &$object, $key) {

		$sets		= array();
		$where		= array();
		$fieldVal	= array();
		$condVal	= array();

		// set table key and values on where conditions
		foreach (get_object_vars($key) as $field => $value) {

			$where[] = $field . ' = ?';
			$condVal[] = $value;

		}

		// set new row values
		foreach (get_object_vars($object) as $field => $value) {
				
			if (is_null($value)) {
				$sets[] = '`' . $field . '` = NULL';
			} else {
				$sets[] = '`' . $field . '` = ?';
				$fieldVal[] = $value;
			}

		}

		// create one list of values to bind
		$values = array_merge($fieldVal, $condVal);

		if (count($sets) and count($where)) {

			// build the SQL query
			$query =
				'UPDATE `' . $table . '`' .
				' SET ' . implode(', ', $sets) .
				' WHERE ' . implode(' AND ', $where);		

			// execute the SQL query
			$res = $this->exec($query, $values);

		} else {
			
			$res = 0;
			
		}
		
		return $res;
		
	}
public function updateObject ( $ table , & $ object , $ key ) { $ sets = array ( ) ; $ where = array ( ) ; $ fieldVal = array ( ) ; $ condVal = array ( ) ; // set table key and values on where conditions
 foreach ( get_object_vars ( $ key ) as $ field => $ value ) { $ where [ ] = $ field . ' = ?' ; $ condVal [ ] = $ value ; } // set new row values
 foreach ( get_object_vars ( $ object ) as $ field => $ value ) { if ( is_null ( $ value ) ) { $ sets [ ] = '`' . $ field . '` = NULL' ; } else { $ sets [ ] = '`' . $ field . '` = ?' ; $ fieldVal [ ] = $ value ; } } // create one list of values to bind
 $ values = array_merge ( $ fieldVal , $ condVal ) ; if ( count ( $ sets ) and count ( $ where ) ) { // build the SQL query
 $ query = 'UPDATE `' . $ table . '`' . ' SET ' . implode ( ', ' , $ sets ) . ' WHERE ' . implode ( ' AND ' , $ where ) ; // execute the SQL query
 $ res = $ this -> exec ( $ query , $ values ) ; } else { $ res = 0 ; } return $ res ; }
Update record of given key on the param object. Properly manage NULL values.

@param	string		DB Table.
@param	stdClass	Object with properties of new values to update.
@param	array		Object with keys and values for where clause.

@return	int			Numbers of affected rows.
Update record of given key on the param object . Properly manage NULL values .