Umil.table row update
From phpBB Development Wiki
umil::table_row_update –– Update a row in a database table using the Umil Library.
Contents |
Description
string umil::table_row_update ( mixed $table_name [, array $data [, array $new_data ]] )
Parameters
| Parameter | Required/Default | Usage |
|---|---|---|
| table_name | Required | The name of the database table to remove. You may just use phpbb_ for the table prefix if you would like. UMIL correctly sets the table prefix to the board's default if you enter in phpbb_ |
| data | default array() | An array of data you would like to search/match for to update with the new data |
| new_data | default array() | An array of data you would like to update the row to (exactly the same data as what would be sent to db::sql_multi_insert) |
Return Values
Returns result or umil_end data
Information
This function is only available in UMIL 1.0.0+
Examples
Example #1
Update one row into the phpbb_test table
$umil->table_row_update('phpbb_test',
array(
'field1' => 'old_value1',
'field2' => 'old_value2',
),
array(
'field1' => 'new_value1',
'field2' => 'new_value2',
),
);
This would be equivalent to:
UPDATE phpbb_test SET field1 = 'new_value1', field2 = 'new_value2' WHERE field1 = 'old_value1' AND field2 = 'old_value2';
See Also

