[SOVED] Codeigniter : Insert Mysql With Whitespace Field


Okay, I updated the code in /system/database/DB_driver.php by modifying the code in the _insert function.

From the initial code as follows:
protected function _insert ($table, $keys, $values)
{
return 'INSERT INTO'. $table. '('. implode (',', $keys). ') VALUES ('. implode (',', $values). ')';
}

Becomes

protected function _insert ($table, $keys, $values)
{
$keys = str_replace ('` `', ' ', $keys);
return 'INSERT INTO'. $ table. '('. implode (',', $keys). ') VALUES ('. implode (',', $values). ')';
}

this method helps me insert using a query builder on columns that have whitespaces.

0 Response to "[SOVED] Codeigniter : Insert Mysql With Whitespace Field"

Posting Komentar