Welcome Guest, Not a member yet? Register   Sign In
Handle mysql errors using query builder
#1

How do I handle errors when using the query builder?
Reply
#2

Read this:

CodeIgniter Users Guide - Database Handling Errors
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply
#3

(12-15-2017, 04:01 AM)InsiteFX Wrote: Read this:

CodeIgniter Users Guide - Database Handling Errors

Thank you for the answer, but this is for simple queries. I am asking for query builder.
Reply
#4

(12-15-2017, 06:20 PM)geabenitez Wrote: Thank you for the answer, but this is for simple queries. I am asking for query builder.

What Query Builder does is write query strings with the various parts provided by separate functions. Eventually, the database method -  _compile_select() - gathers all the input you provide with select(), from(), where(), etc and creates a string.

Inside db->get() it literally calls
PHP Code:
$this->query($this->_compile_select()); 

Inside the query() method a call to simple_query('your compiled select string here');

The moral of all this is that ultimately all Query Builder queries are "simple" queries,

Please feel free to use $this->db->error(); along with Query Builder.
Reply
#5

Thank you, my problem was that it was resolved
Reply
#6

(12-16-2017, 01:56 AM)shf Wrote: Thank you, my problem was that it was resolved

Hello, would you mind to share an example, I cannot get it done. 

thank you.
Reply
#7

(12-19-2017, 11:56 PM)geabenitez Wrote: Hello, would you mind to share an example, I cannot get it done. 

thank you.

What have you tried? (share your code) How were the results different from what you expected?
Reply




Theme © iAndrew 2016 - Forum software by © MyBB