Posted by fikka on December 21, 2012 at 2:16pm
Hi
We're running Drupal 5.23. After recent server updates and restart I have this error, when trying to access a document from MySql database
user warning: FUNCTION mydatabase.db_escape_string does not exist query: SELECT * FROM deliverableDetails WHERE delid=db_escape_string(9) in /usr/share/drupal/includes/database.mysqli.inc on line 156.
I've checked database.mysqli.inc file, the function is defined there.
Can anybody help please?
Thank you!
Comments
This is odd. The error is a
This is odd. The error is a MySQL error, not a Drupal or PHP error. It looks like you have a malformed sql statement somewhere, specifically involving that query, the first of which is listed. I'll see if I can explain:
The function
db_escape_string()is a php function (as you mentioned), but it is not being used as a php function. Rather, it is being included directly into the SQL statement and, since MySQL does not have this function, you are getting the error. This could happen in several ways, but do a search for any query that starts withSELECT * FROM deliverableDetails WHERE delid=and that should narrow it down for you.As for why you just started seeing it after the upgrade, I must ask which version of PHP you upgraded from and to. Later versions of PHP report more errors than their earlier counterparts, so its possible that this error has existed for a long time and only just now is being reported.
- Corey
http://cscrunch.com
Thanks!
Hi Corey,
Thanks for your help, it was exactly the case and after I excluded the function from the query it all started to work well!