The problem was, the application writes session in database (which was not done by me) and my code was closing the connection to database after the operation (which is recommended).
And this error also caused not redirecting as per header('Location:..'); code. And when I investigated and found that when I comment the code which was closing the connection to database, it works.
And when I look into the pages where I was getting the above error, I found that there is no such error now.
It solved in my case, if you have this problem, consult me.
Comments
I'm having this problem, im very new to this kind of scripting, but basicaly i have the following in a number of different areas in my script... Warning: mysql_real_escape_string() [function.mysql-real-escape-string]: Access denied for user 'bensbox'@'lotus.x10hosting.com' (using password: NO) in /home/bensbox/public_html/socialnetwork_root_directory/register.php on line 72 Warning: mysql_real_escape_string() [function.mysql-real-escape-string]: A link to the server could not be established in /home/bensbox/public_html/socialnetwork_root_directory/register.php on line 72 The script is // Connect to database include_once "scripts/connect_to_mysql.php"; $emailCHecker = mysql_real_escape_string($email1); $emailCHecker = eregi_replace("`", "", $emailCHecker); // Database duplicate e-mail check setup for use below in the error handling if else conditionals $sql_email_check = mysql_query("SELECT email FROM myMembers WHERE email='$emailCHecker'"); $email_check = mysql_num_rows($sql_email_check);
Note half way through it does say "The script is" which is where i have copied the script written
Not sure if this helps but I had the same problem. It was because I ran the mysql_real_escape_string before I opened the database connection. Small issue but easily fixed. Unfortunately even though I used mysql_real_escape_string I still have a problem with entering an ingredient called "carrot(s)" into my database without it thinking it is a function!! Regardless, I hope this fixes your problem in the future.
hi there.. i am getting this error message..any ideas?? thx sharon
hi there.. i am getting this error message..any ideas?? Warning: mysql_real_escape_string() [function.mysql-real-escape-string]: Access denied for user 'ODBC'@'localhost' (using password: NO) in C:\xampp\xampp\htdocs\ottica_test\components\com_pbbooking\controller.php on line 164 Warning: mysql_real_escape_string() [function.mysql-real-escape-string]: A link to the server could not be established in C:\xampp\xampp\htdocs\ottica_test\components\com_pbbooking\controller.php on line 164 Warning: mysql_real_escape_string() [function.mysql-real-escape-string]: Access denied for user 'ODBC'@'localhost' (using password: NO) in C:\xampp\xampp\htdocs\ottica_test\components\com_pbbooking\controller.php on line 165 Warning: mysql_real_escape_string() [function.mysql-real-escape-string]: A link to the server could not be established in C:\xampp\xampp\htdocs\ottica_test\components\com_pbbooking\controller.php on line 165 Warning: mysql_real_escape_string() [function.mysql-real-escape-string]: Access denied for user 'ODBC'@'localhost' (using password: NO) in C:\xampp\xampp\htdocs\ottica_test\components\com_pbbooking\controller.php on line 166 thx sharon
place the code that connects to the database first. that is do connection to the database before any other coding. let it be top on your script.