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

WBOY
Libérer: 2016-06-23 14:05:48
original
896 Les gens l'ont consulté

<?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 ?> 
Copier après la connexion


字段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;   
Copier après la connexion

Étiquettes associées:
source:php.cn
Déclaration de ce site Web
Le contenu de cet article est volontairement contribué par les internautes et les droits d'auteur appartiennent à l'auteur original. Ce site n'assume aucune responsabilité légale correspondante. Si vous trouvez un contenu suspecté de plagiat ou de contrefaçon, veuillez contacter admin@php.cn
Tutoriels populaires
Plus>
Derniers téléchargements
Plus>
effets Web
Code source du site Web
Matériel du site Web
Modèle frontal
À propos de nous Clause de non-responsabilité Sitemap
Site Web PHP chinois:Formation PHP en ligne sur le bien-être public,Aidez les apprenants PHP à grandir rapidement!