php+mysql,什么字符可以代表任何值?
如果用户输入了账号,就按账号查询,如何不输入,则查询全部行。代码要怎么写?<?phpheader("Content-Type:text/html;charset=utf-...
如果用户输入了账号,就按账号查询,如何不输入,则查询全部行。
代码要怎么写?
<?php
header("Content-Type: text/html; charset=utf-8");
$zhanghao=$_POST["zhanghao"];
include("conn.php");
$query = "select * from kadan where zhanghao = '$zhanghao' "; 展开
代码要怎么写?
<?php
header("Content-Type: text/html; charset=utf-8");
$zhanghao=$_POST["zhanghao"];
include("conn.php");
$query = "select * from kadan where zhanghao = '$zhanghao' "; 展开
2个回答
展开全部
根据你的问题,个人理解可以用PHP做一下$_POST值的判断,然后采用不同的SQL语句,例如:
<?php
header("Content-Type: text/html; charset=utf-8");
$zhanghao=$_POST["zhanghao"];
include("conn.php");
if(empty($zhanghao)){
$query = "select * from kadan";
}else{
$query = "select * from kadan where zhanghao = '$zhanghao' ";
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询