#33700 [Opn->Bgs]: mysql_real_escape_string does NOT require a mysql connection

From: Date: Fri, 15 Jul 2005 06:02:37 +0000
Subject: #33700 [Opn->Bgs]: mysql_real_escape_string does NOT require a mysql connection
References: 1  Groups: php.doc 
Request: Send a blank email to phpdoc+get-969369151@lists.php.net to get a copy of this message
ID: 33700 Updated by: vrana@php.net Reported By: colder@php.net -Status: Open +Status: Bogus Bug Type: Documentation problem Operating System: WinXP PHP Version: Irrelevant New Comment: It's the same as with any other MySQL function. If no link_identifier is provided and no link does exist, connection is tried to establish with default user/password defined in php.ini. If this fails, mysql_real_escape_string() really generates WARNING and returns FALSE. I documented that in CVS at ref.mysql instead: "Most MySQL functions accept link_identifier as the last optional parameter. If it is not provided, last opened connection is used. If it doesn't exist, connection is tried to establish with default parameters defined in php.ini. If it is not successful, functions return FALSE." Previous Comments: ------------------------------------------------------------------------ [2005-07-14 17:54:36] colder@php.net Description: ------------ mysql_real_ecape_string does not require a mysql connection. That makes the first note wrong: "Note: 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." This function doesn't generate a WARNING and doesn't return FALSE when no connexion is available. I don't know when this behavior changed so I'm unable to provide a patch, sorry. ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=33700&edit=1

« previous php.doc (#969369151) next »