php查询多字段,高手帮帮忙

WBOY
Release: 2016-06-23 14:05:48
Original
897 people have browsed it

<?php  2 /* *  3    4 if($_POST["ip"]=="查询"){ $domain=$_POST[domain];  5 $sql="select * from tblhosting where `domain`='$domain' ";   6 $us=mysql_query($sql);   7 $us=mysql_fetch_row($us);      8 if(is_array($us)){  echo "存在! "; } else echo "不存在!";}  9 ?> 
Copy after login


字段3个!现在查询一个正常! domain 想把这二个加入去!同一个表的 怎么弄!高手帮帮忙 dedicatedip assignedips 谢谢....


回复讨论(解决方案)

if 判断,然后组装sql语句!

三个条件用and 连接就是了

现在查询的不是多字段吗?

硬是没看懂题目~

硬是没看懂题目~ +1

你都查询*了,不是查询的多字段吗??没搞明白。。。

引用 4 楼 BeyondQqiang 的回复:硬是没看懂题目~+1
再+1,真心伤不起,看不懂想问的是什么……

if($_POST["ip1"]=="查询1"){ $domain1=$_POST[domain1];  if($_POST["ip2"]=="查询2"){ $domain2=$_POST[domain2];  if($_POST["ip3"]=="查询3"){ $domain3=$_POST[domain3];  $where = ' domain1=".$domain1." and domain2=".$domain2." and domain3=".$domain3."';$sql="select * from tblhosting where 1 and  ".$where;   
Copy after login

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!