CodeIgniter Forums
Printing Query error - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forumdisplay.php?fid=28)
+--- Forum: CodeIgniter 4 Support (https://forum.codeigniter.com/forumdisplay.php?fid=30)
+--- Thread: Printing Query error (/showthread.php?tid=77389)



Printing Query error - samiul1978 - 08-25-2020

IN CI 3 when there was sql error it prints the whole error query then we find out the error and resolve it but in CI4 only it saying the there was error on line X but did not print the whole query so that we could debug it.

How can CI 4 can print the whole error query ?
Please help.


RE: Printing Query error - php_rocs - 08-26-2020

@samiul1978,

Maybe this is what your looking for... https://codeigniter.com/user_guide/database/queries.html?highlight=query%20error#handling-errors


RE: Printing Query error - samiul1978 - 08-26-2020

(08-26-2020, 09:00 AM)php_rocs Wrote: @samiul1978,

Maybe this is what your looking for... https://codeigniter.com/user_guide/database/queries.html?highlight=query%20error#handling-errors
Do you know if there is sql error happened in CI 3 then what happened ? I want exactly the same thing in CI 4.printing the whole error query.


RE: Printing Query error - php_rocs - 08-26-2020

@samiul1978,

In CI3 I usually checked the log assuming I didn't see the sql error message directly on the screen. Maybe this can be helpful to you ... https://codeigniter.com/user_guide/general/logging.html#logging-information


RE: Printing Query error - Chroma - 08-27-2020

Hi,

This might help...


PHP Code:
        $sql $this->db->showLastQuery();
        print_r($sql); 

It will show you what was actually run.