Skip to main content

Model::updateWhere

Execute Update the records by specified condition

Description

public void Model::updateWhere( string $item, array $data, string $where, array $wh_data )

Arguments

NameData typeDefaultRemarks
$itemstringUpdating columns
$dataarrayUpdating datas
$wherestringUpdating condition query
$wh_dataarrayUpdating condition data

Example

Controller
$model = new Model(false, array(
'table' => 'cms_news',
'id' => 'news_id',
'visible' => 'visible',
));

$item = 'title, body';
$data = array(
'title' => 'Sample title',
'body' => 'Sample body',
);
$model->updateWhere($item, $data, 'id = ?', [1]);