用一串数据"1,2,3,13,14,18,30,40,90,....."来昨条件pId=1;pId=13这样来查的相关记录
解决方案 »
- PHP登陆基础问题?
- php正则表达式提问
- 请教php从业人员,我的一些入职困惑
- 求一邮件服务器软件
- 请教正则:替换不在标签内的指定字符。如<table test>test</table>test,替换成:<table test>2</table>2
- 【求助】wordpress 源码 wp_blog_header.php文件中的不理解
- 匹配问题
- php 如何实现asp 的application 对象! 还有如何统计同时在线人数?
- 请看一下这个程序???
- 新手求助php Unable to create socket套接字问题
- $this的含义!!!
- 我要将客户名单导到excel,用php怎么做?
arr_str=explode(",",$str);
foreach($arr_str as $Val)
{ $condition.=" or pid='".$Val."'";}
if($condition)
{
$condition = "where ".substr($condition,3,strlen($condition)-3);$sql = "select * from table ". $condition ." order by pid asc";
arr_str=explode(",",$str);
foreach($arr_str as $Val)
{ $condition.=" or pid='".$Val."'";}
if($condition)
{
$condition = "where (".str($condition,3,strlen($condition)-3).") ";}
$sql = "select * from table ". $condition ." order by pid asc";如果说还有其它的条件的话,
$condition = " where (".str($condition,3,strlen($condition)-3).") ";
改成;
$condition = " and (".str($condition,3,strlen($condition)-3).") ";$sql = "select * from table where field ='sadgsag' ". $condition ." order by pid asc";
if(!empty($str)){
$sql=" select * from table where id in ( $str ) ";
}...
后面用mysql_query 查即可。