Page 1 of 1
access denies for function.mysql-real-escape-string
Posted: Thu May 04, 2006 3:21 pm
by antuanjoseff
hi,
I have defined some user tags to connect to a mysql database and now I have this error: Warning: mysql_real_escape_string() [function.mysql-real-escape-string]: A link to the server could not be established in /var/www/cmsmadesimple/lib/adodb_lite/adodbSQL_drivers/mysql/mysql_driver.inc on line 174
and then some accents (from the database) in my pages appear propertly and some don't.
Can anyone help me please?
Re: access denies for function.mysql-real-escape-string
Posted: Thu May 04, 2006 3:59 pm
by Ted
So you're using user tags to make a 2nd connection to the database? There could be a configuration issue going on her that is only allowing one connection per request (you have two... one from CMSMS/adodb and one from your tag). Your best bet it to use the adodb connection instead and not open up the 2nd one.
Code: Select all
global $gCms;
$db =& $gCms->GetDb();
Granted, that is an adodb connection, but it shouldn't be any harder to use than the standard php/mysql functionality.
Re: access denies for function.mysql-real-escape-string
Posted: Fri May 05, 2006 6:18 am
by antuanjoseff
Hi,
it was a charset problem.
I created a use tag with utf-8 and my database is in latin1. I solved that and the error dissappear.
Sorry and thanks
Re: access denies for function.mysql-real-escape-string
Posted: Thu Jan 25, 2007 6:03 pm
by booger
Although this is an old post, it bears relevance to a problem I have just encountered, and may help someone else out there.
I also connected to another database using a tag linked to an external php script, and likewise I was receiving the access denied message for mysql-real-escape-string after my script had executed. The error appeared in the cmsms footer. In my case, it was nothing to do with the utf-8 or any other character set, it was because I had used mysql_close($linkname) at the end of my script. Although mysql_close should only have closed the named link, it also appeared to close the link to the cmsms database as well (in a different database on a different server).
So one solution to try for this problem (only if you are connecting to a separate DB or server) is to remove mysql_close at the end of the script.