Welcome Guest, Not a member yet? Register   Sign In
Database error
#1

[eluser]-sek[/eluser]
I am getting a database error

Code:
ERROR - 2009-03-31 13:42:42 --> Severity: Warning  --> mysql_query(): 48 is not a valid MySQL-Link resource dev/codeigniter/system/database/drivers/mysql/mysql_driver.php 140
ERROR - 2009-03-31 13:42:42 --> Severity: Warning  --> mysql_errno(): 48 is not a valid MySQL-Link resource dev/codeigniter/system/database/drivers/mysql/mysql_driver.php 421
ERROR - 2009-03-31 13:42:42 --> Severity: Warning  --> mysql_error(): 48 is not a valid MySQL-Link resource dev/codeigniter/system/database/drivers/mysql/mysql_driver.php 408
ERROR - 2009-03-31 13:42:42 --> Severity: Warning  --> mysql_query(): 48 is not a valid MySQL-Link resource dev/codeigniter/system/database/drivers/mysql/mysql_driver.php 140
ERROR - 2009-03-31 13:42:42 --> Severity: Warning  --> mysql_query(): 48 is not a valid MySQL-Link resource dev/codeigniter/system/database/drivers/mysql/mysql_driver.php 140
DEBUG - 2009-03-31 13:42:42 --> DB Transaction Failure
ERROR - 2009-03-31 13:42:42 --> Query error:

The error message is blank and the error number is empty on the web response page.

The code does not produce an error when the function running the query is given different input values.

I dumped the SQL out and ran it at the command line and it returns a result without error.

I just upgraded to CI 1.7.1 and did have to fix a few queries...apparently the SQL parser did not like some extra whitespace when escaping table names, but that was easy to fix.

This is just puzzling.

Updated After poking about, I tried isolating code before and after the call to the model function in the controller. I could not see anything wrong with the query, so I suspected something was influencing the db connection. I use GoogleMapAPI library in the controller, which depends on PEAR DB, and when I commented out a call to one of its functions, the CI query stopped failing. There may be some conflict between PEAR and CI.

In case someone else encounters this. I've solved the mystery of why the query was failing. It is failing because the database connection is being disconnected by the GoogleMapAPI (http://www.phpinsider.com/php/code/GoogleMapAPI/) library.

which in

Code:
function getCache($address) {

executes

Code:
$_db->disconnect();

before returning data from the geocode cache.

Commenting this line out allows the code to continue executing later CI queries, but leaving it in blocks further CI querying, at least for some section of code until CI reestablishes the database connection.

I was rushed for time integrating this into my app and just did not have time to extend it as a CI library using the CI database. It worked so I left things as they were, but then it developed this issue after an upgrade to a new CI version.




Theme © iAndrew 2016 - Forum software by © MyBB