Welcome Guest, Not a member yet? Register   Sign In
db->last_query() returns false on server
#1

[eluser]Nicolas Connault[/eluser]
I'm completely baffled by this issue. I've been working on a CI app locally for a few months, and I've been uploading it to a test server periodically to check that it works.

Today, after the last update, one of my calls to $CI->db->last_query() returns false on the test server, but returns a SQL string locally.

The codebase and databases are identical. The two servers have the same PHP version, neither of them uses fancy extensions like zend optimizer or xdebug.

I just can't get last_query() to return the last executed query, even if I change the way the query is executed beforehand (count_all_results(), get(), query()).

What could cause this?
#2

[eluser]Nicolas Connault[/eluser]
OK never mind I figured it out! DB caching was turned on in the online server config/database.php file. Evidently last_query() always returns false if the query was cached. Whether this is a feature or an omission, I can't say... Perhaps last_query() is only designed for debugging, but I actually use it for abstraction in my code.




Theme © iAndrew 2016 - Forum software by © MyBB