CodeIgniter Forums

Full Version: How to see MySQL activities on profiler from all active MySQL connections?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

El Forum

[eluser]MatteMatte[/eluser]
Hi Everyone,

On my CI powered website, the profiler is enabled and I can see MySQL activity from the main database set in database.php

But I can not see other MySQL activities happening on other MySQL connections opened dynamically during the code run $config and load->database($config, true) routines.

Any suggestions about how to see all MySQL activities from all MySQL connections on profiler?

Thanks.
Mat.

El Forum

[eluser]WanWizard[/eluser]
If you create a second connection and store it in a local variable, the profiler won't be able to pick it up.

Use:
Code:
$CI =& get_instance();
$CI->db2 = $this->load->database($config, TRUE);
// make it known to our controller
$this->db2 =& $CI->db2;

instead of:
Code:
$db2 = $this->load->database($config, TRUE);

El Forum

[eluser]MatteMatte[/eluser]
Great, thanks! It works like a charm!

Cheers.