Jump to content

mysql_real_escape_string


AncientSage

Recommended Posts

Hello,

Quick question, does the mysql_real_escape_string function have the ability to be used for other databases and such? Or perhaps not even a database at all, or is it a MySQL only function?

If not, then I guess I'll be using addslashes, which is an older less recommended function, is it not?

Thanks.
Link to comment
Share on other sites

The manual states:

[quote]
Parameters

unescaped_string
    The string that is to be escaped.
link_identifier
    The MySQL connection. [b]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.[/b]
[/quote]

In other words, it's going to look for a MySQL connection.

You can:

[list]
[*]Check the manual to see if another database has a similar function; or
[*]Recreate the function to be used for that (or any) database, based on the information that the manual provides:[/list]
[quote]
mysql_real_escape_string() calls MySQL's library function mysql_real_escape_string, which prepends backslashes to the following characters: \x00, \n, \r, \, ', " and \x1a.
[/quote]
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.