I don't think my code's the problem because it's working on my local server (EDIT: sorry if this was the wrong place to ask, but I can't move to ServerFault by myself). On the remote server, though, I can't get mysql_real_escape_string()
to work. The database connection is working, and I'm connecting before calling the function.
When I try echo $_POST['email'];
, I get the right data, but when I try echo mysql_real_escape_string($_POST['email']);
I get nothing.
Here's I get when I leave error reporting on:
Warning: mysql_real_escape_string() [function.mysql-real-escape-string]: [2002] No such file or directory (trying to connect via unix://please_see_the_faq) in /f5/mysite/public/email_results.php on line 11
Warning: mysql_real_escape_string() [function.mysql-real-escape-string]: No such file or directory in /f5/mysite/public/email_results.php on line 11
Warning: mysql_real_escape_string() [function.mysql-real-escape-string]: A link to the server could not be established in /f5/mysite/public/email_results.php on line 11
Is it possible that something with the PHP configuration is causing this? I'm hosting with NearlyFreeSpeech, if it matters.
Here's my insert code:
$db->query('INSERT INTO emails VALUES ("sampleemail@gmail.com")');
And here's how I'm connecting to the database:
@ $db = new mysqli('mysite.db', 'wizard', '(password)', 'mysite');