主页 M

php多条件查询

2014-09-12 网页编程网 网页编程网

<?php
$sql = "select * from student where 1";
if($name) {
$sql .= " and name = '$name'"}
if($sex) {
$sql .= " and sex = '$sex'"}
if($deep) {
$sql .= " and deep = '$deep'"}
?>

阅读原文
阅读 3824
123 显示电脑版