Re: Excluding apostrophe's

From: Date: Sat, 23 Dec 2006 03:41:33 +0000
Subject: Re: Excluding apostrophe's
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-246163@lists.php.net to get a copy of this message
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

« previous php.general (#246163) next »