[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)
{
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 : '');
}
Becomes
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.

3 Responses to "[SOVED] MySql Query Update With White Space Field in Query Builder Codeigniter"

  1. Many men and women struggle with drug and alcohol use does putting drugs in your anus work along with mental illness. In 2018, an estimated 9.2 million people in the U.S. struggled with co-occurring disorders like this, according to the Substance Abuse and mental Health Services Administration.

    BalasHapus
  2. Mild alcohol withdrawal symptoms headache is a hallucinogenic drug. This means that when consumed, it causes the user to have unusual experiences such as hearing sounds, seeing illusions, and feeling things that are not actually there. A drug with an extensive history of both medicinal and recreational use, LSD use does not come without risks. An acid trip can last 12 hours or more, and when it goes wrong it can go terribly wrong. This substance is common at raves, parties, and music festivals, so knowing what acid looks like and understanding the risks is imperative, especially for young adults and teenagers.

    BalasHapus
  3. The We Level Up FL inpatient depression treatment florida emotional wellness community is an exceptionally particular, present day, forward-thinking office giving imaginative conduct recuperation treatment programs. Treatments happen in a serene manicured setting with open air unwinding regions offering restoration spaces. Giving science-based psychological wellness medicines intended for every customer and conveyed through profoundly customized individual consideration.

    BalasHapus