CodeIgniter Forums
builder - trying to escape and array using set() for insert or update - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5)
+--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24)
+--- Thread: builder - trying to escape and array using set() for insert or update (/showthread.php?tid=80771)



builder - trying to escape and array using set() for insert or update - simonf - 12-15-2021

Hi guys,

i am trying to use the following to escape an array of data before updating the database - i just can't seem to get it to work.
(the line $builder->set($data) should escape the data - which references system/Database/BaseBuilder.php)

$data = [
    'title' => $title,
    'name'  => $name,
    'date'  => $date,
];

$builder->where('id', $id);
$builder->set($data);
$builder->update();

(documentation ref: https://www.codeigniter.com/user_guide/database/query_builder.html#updating-data)

Many thanks for any help.


RE: builder - trying to escape and array using set() for insert or update - kenjis - 12-15-2021

(12-15-2021, 12:46 PM)simonf Wrote: i am trying to use the following to escape an array of data before updating the database - i just can't seem to get it to work.


It must be escaped. How do you know it is not escaped?