public function update($table, $columns, $where = '', $replacements = '', $highlight = false) {

        // if $replacements is specified but it's not an array
        if ($replacements != '' && !is_array($replacements))

            // save debug information
            return $this->_log('unsuccessful-queries', array(

                'query' => '',
                'error' => $this->language['warning_replacements_not_array']

            ));

        // generate the SQL from the $columns array
        $cols = $this->_build_sql($columns);

        // run the query
        $this->query('

            UPDATE
                ' . $this->_escape($table) . '
            SET
                ' . $cols .
            ($where != '' ? ' WHERE ' . $where : '') . '

        ', array_merge(array_values($columns), $replacements == '' ? array() : $replacements), false, false, $highlight);

        // return TRUE if query was successful, or FALSE if it wasn't
        return isset($this->last_result) && $this->last_result !== false;

    }
public function update($table, $columns, $where = '', $replacements = '', $highlight = false) {

        // if $replacements is specified but it's not an array
        if ($replacements != '' && !is_array($replacements))

            // save debug information
            return $this->_log('unsuccessful-queries', array(

                'query' => '',
                'error' => $this->language['warning_replacements_not_array']

            ));

        // generate the SQL from the $columns array
        $cols = $this->_build_sql($columns);

        // run the query
        $this->query('

            UPDATE
                ' . $this->_escape($table) . '
            SET
                ' . $cols .
            ($where != '' ? ' WHERE ' . $where : '') . '

        ', array_merge(array_values($columns), $replacements == '' ? array() : $replacements), false, false, $highlight);

        // return TRUE if query was successful, or FALSE if it wasn't
        return isset($this->last_result) && $this->last_result !== false;

    }
public function update ( $ table , $ columns , $ where = '' , $ replacements = '' , $ highlight = false ) { // if $replacements is specified but it's not an array if ( $ replacements != '' && ! is_array ( $ replacements ) ) // save debug information return $ this -> _log ( 'unsuccessful-queries' , array ( 'query' => '' , 'error' => $ this -> language [ 'warning_replacements_not_array' ] ) ) ; // generate the SQL from the $columns array $ cols = $ this -> _build_sql ( $ columns ) ; // run the query $ this -> query ( '

            UPDATE
                ' . $ this -> _escape ( $ table ) . '
            SET
                ' . $ cols . ( $ where != '' ? ' WHERE ' . $ where : '' ) . '

        ' , array_merge ( array_values ( $ columns ) , $ replacements == '' ? array ( ) : $ replacements ) , false , false , $ highlight ) ; // return TRUE if query was successful, or FALSE if it wasn't return isset ( $ this -> last_result ) && $ this -> last_result !== false ; }
Shorthand for UPDATE queries.

When using this method column names will be enclosed in grave accents " ` " (thus, allowing seamless usage of
reserved words as column names) and values will be automatically {@link escape()}d in order to prevent SQL injections.

After an update check {@link affected_rows} to find out how many rows were affected.

<code>
// notice that we're using a MySQL function as a value
$db->update(
'table',
array(
'column1'       =>  'value1',
'column2'       =>  'value2',
'date_updated'  =>  'NOW()',
),
'criteria = ?',
array($criteria)
);

// when using MySQL functions, the value will be used as it is without being escaped!
// while this is ok when using a function without any arguments like NOW(), this may
// pose a security concern if the argument(s) come from user input.
// in this case we have to escape the value ourselves
$db->update(
'table',
array(
'column1'       =>  'TRIM(UCASE("' . $db->escape($value1) . '"))',
'column2'       =>  'value2',
'date_updated'  =>  'NOW()',
),
'criteria = ?',
array($criteria)
);
</code>

@param  string  $table          Table in which to update.

<i>May also be given like databasename.tablename if a database was not explicitly
selected with the {@link connect()} or {@link select_database()} methods prior to
calling this method.</i>

@param  array   $columns        An associative array where the array's keys represent the columns names and the
array's values represent the values to be inserted in each respective column.

Column names will be enclosed in grave accents " ` " (thus, allowing seamless
usage of reserved words as column names) and values will be automatically
{@link escape()}d.

A special value may also be used for when a column's value needs to be
incremented or decremented. In this case, use <i>INC(value)</i> where <i>value</i>
is the value to increase the column's value with. Use <i>INC(-value)</i> to decrease
the column's value:

<code>
$db->update(
'table',
array(
'column'    =>  'INC(?)',
),
'criteria = ?',
array(
$value,
$criteria
)
);
</code>

...is equivalent to

<code>
$db->query('
UPDATE
table
SET
column = column + ?
WHERE
criteria = ?
', array($value, $criteria));
</code>

You may also use any of {@link http://www.techonthenet.com/mysql/functions/ MySQL's functions}
as <i>values</i>.

<samp>Be aware that when using MySQL functions, the value will be used as it is
without being escaped! While this is ok when using a function without any arguments
like NOW(), this may pose a security concern if the argument(s) come from user input.
In this case make sure you {@link escape} the values yourself!</samp>

@param  string  $where          (Optional) A MySQL WHERE clause (without the WHERE keyword).

Default is "" (an empty string).

@param  array   $replacements   (Optional) An array with as many items as the total parameter markers ("?", question
marks) in <i>$where</i>. Each item will be automatically {@link escape()}-ed and
will replace the corresponding "?". Can also include an array as an item, case in
which each value from the array will automatically {@link escape()}-ed and then
concatenated with the other elements from the array - useful when using <i>WHERE
column IN (?)</i> conditions. See second example {@link query here}.

Default is "" (an empty string).

@param  boolean $highlight      (Optional) If set to TRUE the debugging console will be opened automatically
and the query will be shown - really useful for quick and easy debugging.

Default is FALSE.

@since  1.0.9

@return boolean                 Returns TRUE on success of FALSE on error
Shorthand for UPDATE queries .