if($choice="all"){ //选择全部 $sql = "SELECT * FROM `TABLE_NAME` where `name` like '$textfield' or `job` like '$textfield'"; } if($choice = "name"){ //选择姓名 $sql = "SELECT * FROM TABLE_NAME where `name` like '$textfield'"; } if($choice = "job"){ //选择职业 $sql = "SELECT * FROM TABLE_NAME where `job` like '$textfield'"; } 再执行$sql语句
结构应该是:PHP+数据库。
结构为:php+mysql,我们公司使用的是北大方正sp段新平台,北大方正MediaSMSV1.3!
应该是程序内部出现的问题,对吧!另外,uesr form:elements为空或不为对象,会是什么问题呢?
echo $sql
然后放到查询分析器里面执行。速度太满可能是因为数据太多。
可以通过优化sql语句来查询。如果是oracle可以通过指定行数据来取,速度比较块。
选择查询条件
<select name="choice">
<option value="all">全部</option>
<option value="name">姓名</option>
<option value="job">职业</option>
</select>
输入关键词:
<input name="textfield" type="text" size="10">
<input type="submit" name="Submit" value="提交">
</form>a.php
$choice = $_POST['choice'];
if($choice="all"){}
$choice = $_POST['choice'];
$textfield = $_POST['textfield'];
if($choice="all"){ //选择全部
$sql = "SELECT * FROM `TABLE_NAME` where `name` like '$textfield' or `job` like '$textfield'";
}
if($choice = "name"){ //选择姓名
$sql = "SELECT * FROM TABLE_NAME where `name` like '$textfield'";
}
if($choice = "job"){ //选择职业
$sql = "SELECT * FROM TABLE_NAME where `job` like '$textfield'";
}
再执行$sql语句