note 51686 added to function.mysql-real-escape-string

From: Date: Thu, 07 Apr 2005 15:25:30 +0000
Subject: note 51686 added to function.mysql-real-escape-string
Groups: php.notes 
Request: Send a blank email to php-notes+get-87661@lists.php.net to get a copy of this message
The problem with this function returning an empty string instead of an escaped string seems to be related to the mysql lib versions installed on the server. On 3 servers, each with php 4.3.10, I had no problems on 2 of them, but got the empty string on the 3rd. The 2 that worked had versions 4.1.x and 4.0.x of mysql. The 3rd that did not work had 3.23.x The failure also only occurred when I did not have a mysql connection set up before running the escape function. If I did DB::connect (using the PEAR DB object) before running the function, it worked, even if I didn't pass in the connection id. If I ran the function before DB::connect, then I got an empty string. So, if you are getting an empty string, check your mysql lib version and check where you are connecting to the db in relation to calling the escape function in your code. ---- Manual Page -- http://www.php.net/manual/en/function.mysql-real-escape-string.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+51686 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+51686&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+51686&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+51686&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+51686&report=yes&reason=useless Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+51686&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+51686&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#87661) next »