Mysql_real_escape_string () completely removes the row

I avoid all string parameters that I get from php form, for example:

$usr_name = mysql_real_escape_string($_REQUEST['usr_name']); 

to avoid a few problems with SQL Injection. But when I return from the function, I get nothing.

I also keep getting this strange warning in my PHP log:

 PHP Warning: mysql_real_escape_string() [<a href='function.mysql-real-escape-string'>function.mysql-real-escape-string</a>]: A link to the server could not be established in /hermes/bosweb/web279/b2798/ipw.bankingforms/public_html/formAckResponse_controller.php on line 39 

The host uses: PHP Version 4.4.7

+6
php mysql mysql-real-escape-string
source share
1 answer

From PHP.net:

Note. Connection to MySQL is required Before using mysql_real_escape_string() otherwise an error of level E_WARNING is equal and returns FALSE . If link_identifier not defined, the last MySQL connection is used.

In other words, you will need to connect to the MySQL database via mysql_connect() or mysql_pconnect() before you can use this function.

+17
source share

All Articles