Join Up!
96806 members and counting!

 
downloads | documentation | faq | getting help | mailing lists | reporting bugs | php.net sites | links 
search for in the  
previousmysql_querymysql_resultnext
Last updated: Tue, 29 Oct 2002
view the printer friendly version or the printer friendly version with notes or change language to Czech | Finnish | German

mysql_real_escape_string

(PHP 4 CVS only)

mysql_real_escape_string --  Escapes special characters in a string for use in a SQL statement, taking into account the current charset of the connection.

Description

string mysql_real_escape_string ( string unescaped_string [, resource link_identifier])

This function will escape special characters in the unescaped_string, taking into account the current charset of the connection so that it is safe to place it in a mysql_query().

Nota: mysql_real_escape_string() does not escape % and _.

Ejemplo 1. mysql_real_escape_string() example

<?php
$link = mysql_connect('localhost', 'mysql_user', 'mysql_password');
$item = "Zak's and Derick's Laptop";
$escaped_item = mysql_real_escape_string($item);
printf ("Escaped string: %s\n", $escaped_item);
?>

The above example would produce the following output:
Escaped string: Zak\'s and Derick\'s Laptop

See also: mysql_escape_string(), mysql_character_set_name().

User Contributed Notes
mysql_real_escape_string
add a note about notes
There are no user contributed notes for this page.
previousmysql_querymysql_resultnext
Last updated: Tue, 29 Oct 2002
Copyright © 2001, 2002 The PHP Group
All rights reserved.
This mirror generously provided by: http://phpbuilder.com/
Last updated: Thu Oct 31 18:34:28 2002 EST