debugging Models |
[eluser]jtan[/eluser]
Is it possible to debug the Model in Codeigniter? I want to check whether the mistake is in the Controller or the Model, hence would like to get the result of the Models directly without loading the Views.
[eluser]Eric Barnes[/eluser]
You can just echo, print_r, var_dump etc in the model. Or use unit testing.
[eluser]mddd[/eluser]
Or you can use the log_message() function to write information to the log file. Code: log_message('debug', 'Some_model: value of $somevar: '. $somevar);
[eluser]Ngulo[/eluser]
hi guys...i'm referring to this post cause i'm trying debugging with an echo a query like this: Code: $query = $this->db->select('id','ip','date') but it always returns me this error: Code: A PHP Error was encountered thanks
[eluser]danmontgomery[/eluser]
You're never executing the query. from() doesn't return a compiled query, it returns the database object. You need to execute the query with get() or get_where() first. Also, select() fields aren't individual parameters, they should all be one: Code: select('id,ip,date') Code: select('id','ip','date') user guide
[eluser]Eric Barnes[/eluser]
[quote author="noctrum" date="1280185555"]You're never executing the query. from() doesn't return a compiled query, it returns the database object.[/quote] Good catch! ![]() Code: $query = $this->db->get();
[eluser]pickupman[/eluser]
Even better try: Code: $this->output->enable_profiler(TRUE); Get execution time, memory, $_REQUEST array, all sql queries with query times.
|
Welcome Guest, Not a member yet? Register Sign In |