4.2.2 doesn't have mysql_real_esacpe_string()
| From: | Danny Anderson | Date: | Wed, 31 Dec 2003 16:47:28 +0000 |
| Subject: | 4.2.2 doesn't have mysql_real_esacpe_string() | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-173550@lists.php.net to get a copy of this message | ||
Hola, PHP folk!
I am learning about PHP from a book (MySQL/PHP Database Applications). I have been following the examples in the book, modifying them to suit my purpose and experiment, etc.
I am using an old work machine my webserver. I did a Redhat 9 install, adding MySQL version 4. The 'stock' Redhat installation of PHP was version 4.2.2. Having this older version had presented no problems until now. The example I am currently working on uses a function mysql_real_escape_string(), which is only in php 4.3.0 and higher. An example of the how the function is used:
[code]
$query = sprintf($query
, mysql_real_escape_string($name)
, mysql_real_escape_string($location)
, mysql_real_escape_string($email)
, mysql_real_escape_string($url)
, mysql_real_escape_string($comments)
, mysql_real_escape_string($_SERVER['REMOTE_ADDR'])
);
safe_mysql_query($query);
[/code]
I am looking for recommendations on what I should do. I can upgrade to the latest version of PHP if need be, though I am not particulary eager to do so, since everything else has been playing nice with each other.
The lazy person inside of me is looking for a painless answer, something along the lines of "just use mysql_foo() instead, it does the same thing as that function that isn't in 4.2.2"
Thanks,
Danny