[code=php]
	/**
	 * Update query builder
	 *
	 * @author Marten van Urk .: ComSi www.comsi.nl :.
     * @package Invoice
	 * @subpackage Products
     * @param String $table Table which will be updated
     * @param String $idField The updated key field (for example the auto increment field) Will be used in combination with $id for the where statement
	 * @param Integer $id The id of the given field
	 * @param Array $aUpdateValues
	 * @since 1.0 
	 * @return Boolean On succes the boolean true will be returned otherwise, on a fail the boolean false will be returned.
	 */
    static private $tableLoaded = array(); 
       
	public function modify($table, $idField, $id, $aUpdateValues = array()) {
		if(count($aUpdateValues ) == 0) {
            return false;
		}
        
		try {		          
            /**
             * Check if query is runned before
             **/              
            if(!isset($this->tableLoaded[$table])) {
                $this->tableLoaded[$table] = $this->db->query("SHOW COLUMNS FROM " . $table);    
            } 
            
			$aFields = array();
			foreach ($this->tableLoaded[$table] as $r) {
				$aFields[$r[0]] = '';
			}
		} catch (Exception $e) {
			return false;
		}		
		
		foreach ($aUpdateValues as $key => $value) {
                    if(array_key_exists($key, $aFields)) {
                        if(ctype_digit($value)) {
                            $sets[] = '`'.$key.'` = ' .$value;
                        } else {
                            $sets[] = '`'.$key.'` = \''.$value.'\'';    
                        }            	
                    }
		}
        
		$sQuery = "UPDATE `" .$table. "` " . 'SET ' .implode(', ', $sets) . " WHERE " .$idField. " = " . $id;
        
		try {
			$rResult_update = $this->db->query($sQuery);
			return true;
		} catch (Exception $e) {
			return false;
		}		
	}
