mysql的使用

<?php
/**
* mysql_real_escape_string -转义sql语句中使用的字符串中的特殊字符,并考虑到连接的当前字符集,
* mysql_real_escape_string()不转义%和_
*
* mysql_real_escape_string(string $unescaped_string[,resource $link_identiffer])
* 本函数将unescaped_string中的特殊字符串转义,并计及连接的当前字符集,因此可以安全用于mysql_query()
*/
$item="zak's and Derick's Laptop";
$escape_item=mysql_real_escape_string($item);

print_r($escape_item);

posted @ 2012-12-20 08:59  sgsheg  阅读(110)  评论(0编辑  收藏  举报