Re: Excluding apostrophe's

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




RAFMTD (Ian) wrote:
...
$name = mysql_real_escape_string ($_POST['name']);
...
mysql_connect("humbug",$username,$password);
...
the script fails with the following report Warning:
mysql_real_escape_string(): Can't connect to local MySQL server through
socket '/var/run/mysqld/mysqld.sock' (2)


At 12/22/2006 05:36 AM, Stut wrote:
You need to connect to the database before using mysql_real_escape_string.


Ian, this is a perfect example of when it comes in handy to consult the documentation:
________________________

http://ca.php.net/manual/en/function.mysql-real-escape-string.php

string mysql_real_escape_string ( string unescaped_string [, resource link_identifier] )

Escapes special characters in the unescaped_string, taking into account the current character set of the connection....
...
link_identifier

The MySQL connection. If the link identifier is not specified, the last link opened by mysql_connect() is assumed. If no such link is found, it will try to create one as if mysql_connect() was called with no arguments. If by chance no connection is found or established, an E_WARNING level warning is generated.
________________________

Remember, my son, PHP-general helps those who help themselves.

Piously,

Poop Paul
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux