<?php
$str = 'indistinct';
if (preg_match('/[^in]distinct/',$str)) {
echo "OK";
} else {
echo "Error";
}
?>
给分给分
$str = 'indistinct';
if (preg_match('/[^in]distinct/',$str)) {
echo "OK";
} else {
echo "Error";
}
?>
给分给分
解决方案 »
- 请教一个错误Warning: rawurlencode() expects parameter 1 to be string, array given
- 关于 ajax
- 急~~哪位大侠来帮忙呀 谢谢呀 php搜索问题
- 为什么我的php写入数据库总是失败,大家看一看
- 請各位高手給我指點下,這個表格自動切換問題.........
- eclipse(PDT)中如何增加PHP库函数,比如memcached
- 初学PHP,遇到一个问题,请求大家帮助~
- 请问sum(XXX) 和limit 0,20不用一起用么?
- 请教mysql问题
- 页面白屏一般是怎么了?怎么造成的?
- EDITPLUS如何使用定位功能?
- 转义符添加为何无用?
$sSQL="select count(".$reg[0].") ".strstr($query,"from");结果碰上"select * from t1 where f1 in (select distinct f1 from t2)",又不行了现在eregi($patten,$sSQL,$reg),想求$patten的写法
if (preg_match('/(^in)distinct/',$str)) {
echo "Error";
} else {
echo "OK";
}
$sSQL="select count(".$reg[0].") ".strstr($sSQL,"from");我想让$reg[0]的值为"distinct 字段名"……谢谢
首先mysql并不支持这个写法:"select * from t1 where f1 in (select distinct f1 from t2)",所以也无通用可言了。
其次,在你的表达式中并未出现(),所以在eregi(" distinct +[[:alnum:]]+",$sSQL,$reg)后,$reg是无效的。
取出select的后的字段列表,只需排除distinct即可
没有(),也能用呀,在只匹配一个东西的情况下
{
$reg[2]="0";
}
$sSQL="select count(".$reg[2].") ".strstr($sSQL,"from");应该是可以了,谢谢大家