Welcome Guest, Not a member yet? Register   Sign In
Logging all sql-queries
#1

How I can log all sql-queries in current page?

I found this code

PHP Code:
$this->db->queries 


but when I located it at the end of index.php, it crashed the site.
Reply
#2

@fs444,

Do you want to log queries during Production or only during Development?
Reply
#3

$this isn't in scope in the index.php. $this is when you're inside a class, and ->queries is only there if you're in a class that has the ci3 god object.
Codeigniter is simply one of the tools you need to learn to be a successful developer. Always add more tools to your coding arsenal!
Reply
#4

(07-03-2020, 02:04 PM)php_rocs Wrote: @fs444,

Do you want to log queries during Production or only during Development?
only during Development
Reply
#5

@fs444,

There is a couple of ways to approach this.
- You could turn on the profiler for this page which will list ALL executed queries (at the bottom of the page). [https://codeigniter.com/userguide3/gener...pplication]
- You could turn on logging which tracks all executed queries along with other system messages. [https://codeigniter.com/userguide3/gener...r-handling]
Reply




Theme © iAndrew 2016 - Forum software by © MyBB