I have multiple rows in database.
I need to collect all the rows based on certain condition and change the value of particular column by removing a word from the column's value.
How it could be done with with CakePHP 3?
Add this on top of the controller "use Cake\Datasource\ConnectionManager;"
$this->loadModel('Rewards');
$connection = ConnectionManager::get('default');
$results = $connection->execute("UPDATE rewards SET description = REPLACE (description, 's', 'a') where is_disabled=1");
I have values in description fields 'wwss' now that fields word replace into 'wwaa' like that.
For more explanation refer this link
http://book.cakephp.org/3.0/en/orm/database-basics.html
How can I use mySQL replace() to replace strings in multiple records?
Please review,Thanks!
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments