CodeIgniter Forums
database class problem - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21)
+--- Thread: database class problem (/showthread.php?tid=5088)



database class problem - El Forum - 01-05-2008

[eluser]emperius[/eluser]
I created an associative array
Code:
$addarray = array('field1' => $_POST['field1'], 'field2' => $_POST['field2']);
then I try to add this string to DB
Code:
$this->db->insert_string('table', $addarray)

this doesn't work at me

and when I try to see the query string I get empty string...

How to find out what is the problem?
And how can I see the query?


database class problem - El Forum - 01-05-2008

[eluser]Sarfaraz Momin[/eluser]
incorrect
Code:
$this->db->insert_string('table', $addarray);
correct
Code:
$this->db->insert('table', $addarray);


Please check the manual for the same.

To check queries you can simply enable profiling and it will show you all the queries on the page.
Code:
$this->output->enable_profiler(TRUE);

Good Day !!!


database class problem - El Forum - 01-05-2008

[eluser]xwero[/eluser]
If you want to check the last query you can use
Code:
$this->db->last_query();



database class problem - El Forum - 01-06-2008

[eluser]emperius[/eluser]
thank you

everything works Smile