PHP.nl

mysql_escape_string

mysql_escape_string

Escapes a string for use in a mysql_query

Waarschuwing: > mysqli_escape_string``PDO::quote

string **mysql_escape_string** string $unescaped_string

This function will escape the , so that it is safe to place it in a . This function is deprecated. unescaped_string``mysql_query

This function is identical to except that takes a connection handler and escapes the string according to the current character set. does not take a connection argument and does not respect the current charset setting. mysql_real_escape_string``mysql_real_escape_string``mysql_escape_string

unescaped_stringThe string that is to be escaped.

Returns the escaped string.

Voorbeeld: example

<?php
$item = "Zak's Laptop";
$escaped_item = mysql_escape_string($item);
printf("Escaped string: %s\n", $escaped_item);
?>
Escaped string: Zak\'s Laptop

Opmerking: > does not escape and . mysql_escape_string``%``_

mysql_real_escape_string