mysql_escape_string & mysql_real_escape_string
mysql_escape_string
==============
mysql_escape_string
- It escapes a string for use in a mysql_query. This function will escape the unescaped_string, so that it is safe to place it in a
mysql_query(). It is similar to addslashes() function It does not escape % and _.
Syntax:
=====
string mysql_escape_string ( string unescaped_string)
Example:
=======
$str = "your's";
echo $str = mysql_escape_string($str);
The Output is
your\'s
===========================
======================================
====================================
mysql_real_escape_string
==================
mysql_real_escape_string
- It escapes special characters in a string for use in a SQL statement, taking into account the current charset of the connection.
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(). It is similar to mysql_escape_string.
Syntax:
=====
string mysql_real_escape_string ( string unescaped_string [, resource link_identifier])
====================================
=====================================
===============================
