db::update PHP Method

update() static public method

Runs an UPDATE query
static public update ( string $table, mixed $input, mixed $where ) : mixed
$table string The table name
$input mixed Either a key/value array or a valid MySQL insert string
$where mixed Either a key/value array as AND connected where clause or a simple MySQL where clause string
return mixed The number of affected rows or an error response
    static function update($table, $input, $where)
    {
        return self::execute('UPDATE ' . self::prefix($table) . ' SET ' . self::values($input) . ' WHERE ' . self::where($where));
    }

Usage Example

Example #1
0
 function saveMail()
 {
     db::table('mails');
     db::where('mail_id', admin::get('id'));
     db::update(array('mail_name' => params::get('mail_name'), 'mail_subject' => params::get('mail_subject'), 'mail_content' => params::get('mail_content')));
     headers::self();
 }
All Usage Examples Of db::update