I have a strange bug in my Code Igniter application. When I call mysql_real_escape_string, Code Igniter or PHP issues this error.
<h4>A PHP Error was encountered</h4>
<p>Severity: Warning</p>
<p>Message: mysql_real_escape_string() [<a href='function.mysql-real-escape-string'>function.mysql-real-escape-string</a>]: Can't connect to local MySQL server through socket '/No-MySQL-hostname-was-specified' (2)</p>
<p>Filename: helpers/formval_helper.php</p>
<p>Line Number: 13</p>
Why does simply calling mysql_real_escape_string trigger access to my localhost database? Doesn’t that function just format a string? Also, I’m not even using my localhost database.
http://php.net/manual/en/function.mysql-real-escape-string.php
A MySQL connection is required before using mysql_real_escape_string() otherwise an error of level E_WARNING is generated, and FALSE is returned. If link_identifier isn’t defined, the last MySQL connection is used.