CodeIgniter Forums
$model->update([], ['column' => NULL]) set the whole table column to null - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forumdisplay.php?fid=28)
+--- Forum: CodeIgniter 4 Support (https://forum.codeigniter.com/forumdisplay.php?fid=30)
+--- Thread: $model->update([], ['column' => NULL]) set the whole table column to null (/showthread.php?tid=85230)



$model->update([], ['column' => NULL]) set the whole table column to null - eelisland - 12-06-2022

Hello,

PHP Code:
$model model('myModel');

$model->update([], ['column' => NULL]); 

If the first argument is an empty array, the entire table is affected, is it the normal behavior ?

CI 4.2.6


RE: $model->update([], ['column' => NULL]) set the whole table column to null - kenjis - 12-06-2022

See https://forum.codeigniter.com/showthread.php?tid=84833


RE: $model->update([], ['column' => NULL]) set the whole table column to null - iRedds - 12-07-2022

Don't pass an empty array.


RE: $model->update([], ['column' => NULL]) set the whole table column to null - eelisland - 12-08-2022

@kenjis @iRedds
Thanks for your feedbacks.