MySQL Functions in Codeigniter Data

codeigniter, insert, mysql, php

Solution

you can use `$this->db->set('my_id', 'UUID()', FALSE);`

For passing mltiple params,

$data = array(.....) //add the params.
$this->db->set('my_id', 'UUID()', FALSE);
$this->db->insert('my_table',$data);

Problem

Using codeigniter I'm trying to insert a row into my database, but I want the data in the row to be generated by MySQL. What is the proper way of doing it? ``` $data['my_id'] = 'UUID()'; $db->insert('my_table',$data); ``` Obviously the above won't work, but how can I make it function? EDIT: Theoretically this is what the above should produce: ``` INSERT INTO my_table (my_id) VALUES (UUID()); ``` Naturally my actually query isn't that simple, but that should get the point across.

Original source

Related problems