1. mysql如何过滤特殊字符用PHP语言。高分求助,给补分
^function deletehtml($str) {
$str = trim($str);
$str = preg_replace("</P>","1234a3211",$str);
$str = preg_replace("</p>","1234a3211",$str);
$str = preg_replace("<br/>","1234a3211",$str);
$str = preg_replace("/<(.[^>]*)>/","",$str);
$str = preg_replace("/([\r\n])[\s]+/","",$str);
$str = preg_replace("/-->/","",$str);
$str = preg_replace("/<!--.*/","",$str);
$str = preg_replace("/&(quot|#34);/","",$str);
$str = preg_replace("/&(amp|#38);/", "/&/",$str);
$str = preg_replace("/&(lt|#60);/", "/</",$str);
$str = preg_replace("/&(gt|#62);/", ">",$str);
$str = preg_replace("/&(nbsp|#160);/", "",$str);
$str = preg_replace("/&(iexcl|#161);/", "/\xa1/",$str);
$str = preg_replace("/&(cent|#162);/", "/\xa2/",$str);
$str = preg_replace("/&(pound|#163);/", "/\xa3/",$str);
$str = preg_replace("/&(|#169);/", "/\xa9/",$str);
$str = preg_replace("/(\d+);/", "",$str);
$str = preg_replace("/</", "",$str);
$str = preg_replace("/>/", "",$str);
$str = preg_replace("/\r\n/", "",$str);
$str = preg_replace("/1234a3211/", "/<br/>/",$str);
return $str;
}
2. mysql中怎么筛选出含有某个字符的数据并且替换
可以参考下列例子,将字段1中含有的字符串'aaa'替换为'bbb'
update t1 set col1=replace(col1,'aaa','bbb');
3. Mysql怎么筛选不以某串数字加一段字符串结尾的字段
MySQL——使用正则表达式查询
如果你会正则表达式的话,可以用正则表达式来过滤。
4. MYSQL 中 怎样从字符串中提取 数字 也就是过滤掉非数字的字符~
单存用mysql 是实现不了的,如果加上php 就可以实现了!
php 直接把数据+0就可以取字符串里面的数字了~