[SOVED] MySql Query Update With White Space Field in Query Builder Codeigniter
Okay, I updated the code in /system/database/DB_driver.php by modifying the code in the _update function.
From the initial code as follows:
protected function _update($table, $values)Becomes
{
foreach ($values as $key => $val) {
$valstr[] = $key . ' = ' . $val;
}
return 'UPDATE ' . $table . ' SET ' . implode(', ', $valstr)
. $this->_compile_wh('qb_where')
. $this->_compile_order_by()
. ($this->qb_limit ? ' LIMIT ' . $this->qb_limit : '');
}
protected function _update($table, $values)
{
foreach ($values as $key => $val) {
$key = str_replace('` `', ' ', $key);
$valstr[] = $key . ' = ' . $val;
}
return 'UPDATE ' . $table . ' SET ' . implode(', ', $valstr)
. $this->_compile_wh('qb_where')
. $this->_compile_order_by()
. ($this->qb_limit ? ' LIMIT ' . $this->qb_limit : '');
}
this method helps me update using a query builder on columns that have whitespaces.