Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

mysql_real_escape_string() error

Explorer ,
Jan 11, 2011 Jan 11, 2011

Hey guys,


Why do I get an error when I try to keep the incoming data harmless using mysql_real_escape_string() function?

$pavadinimas = $_POST['name'];
$tekstas = $_POST['tekstas'];
$id = $_POST['id'];
mysql_real_escape_string($pavadinimas);
mysql_real_escape_string($tekstas);
mysql_real_escape_string($id);

Cheers,

DissidentPJ

TOPICS
Server side applications
1.9K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Jan 11, 2011 Jan 11, 2011

What is the error you are getting?

Gary

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jan 12, 2011 Jan 12, 2011

PLENTY OF THEM:

Warning:  mysql_real_escape_string() [function.mysql-real-escape-string]: [2002] A connection attempt failed because the connected party did not  (trying to connect via tcp://localhost:3306) in D:\Darbai\serveris\UniServer\www\update.php on line 15

Warning:  mysql_real_escape_string() [function.mysql-real-escape-string]:  A connection attempt failed because the connected party did not  properly respond after a period of time, or established connection  failed because connected host has failed to respond.  in D:\Darbai\serveris\UniServer\www\update.php on line 15

Warning:  mysql_real_escape_string() [function.mysql-real-escape-string]: A link to the server could not be established in D:\Darbai\serveris\UniServer\www\update.php on line 15

Warning:  mysql_real_escape_string() [function.mysql-real-escape-string]: [2002] A connection attempt failed because the connected party did not  (trying to connect via tcp://localhost:3306) in D:\Darbai\serveris\UniServer\www\update.php on line 16

Warning:  mysql_real_escape_string() [function.mysql-real-escape-string]:  A connection attempt failed because the connected party did not  properly respond after a period of time, or established connection  failed because connected host has failed to respond.  in D:\Darbai\serveris\UniServer\www\update.php on line 16

Warning:  mysql_real_escape_string() [function.mysql-real-escape-string]: A link to the server could not be established in D:\Darbai\serveris\UniServer\www\update.php on line 16

Warning:  mysql_real_escape_string() [function.mysql-real-escape-string]: [2002] A connection attempt failed because the connected party did not  (trying to connect via tcp://localhost:3306) in D:\Darbai\serveris\UniServer\www\update.php on line 17

Warning:  mysql_real_escape_string() [function.mysql-real-escape-string]:  A connection attempt failed because the connected party did not  properly respond after a period of time, or established connection  failed because connected host has failed to respond.  in D:\Darbai\serveris\UniServer\www\update.php on line 17

Warning:  mysql_real_escape_string() [function.mysql-real-escape-string]: A link to the server could not be established in D:\Darbai\serveris\UniServer\www\update.php on line 17

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Jan 12, 2011 Jan 12, 2011

The errors are telling you that the connection was not made to your database. I assume you are trying to connect to your local testing server?  If you are trying to connect to your remote server, then your connection settings are wrong, they are pointing to your hard drive, Most likely a case of you changing from local to remote connections.

If that is not the case, and since you only have 3 instances, remove the mysql_real_escape_string() function and test your connection.  If you do connect, then you would need to post more information to see where you are going astray.

Gary

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jan 13, 2011 Jan 13, 2011
LATEST

DissidentPJ wrote:

Why do I get an error when I try to keep the incoming data harmless using mysql_real_escape_string() function?

You must connect to the database before you can use mysql_real_escape_string(). See http://docs.php.net/manual/en/function.mysql-real-escape-string.php.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines