keyword=EnCode(request("keyword"))
set rs=server.CreateObject("adodb.recordset")
sqlstr="select s.id,s.OrderNum,s.fullPinyin,s.spotsName,(select city.cityName from [tb_City] city where city.id=s.cityID) cityName,(case s.TimeInterval when 1 then '夜间' else '白天' end) TimeInterval,s.teamPrice,s.fitPrice,s.editDate from tb_Spots s where s.useType=0"
if keyword<>"" then
sqlstr=sqlstr&" and (s.spotsName like '%"&keyword&"%' or s.contents like '%"&keyword&"%')"
end if
sqlstr=sqlstr&" order by s.OrderNum asc,s.id desc"
rs.open sqlstr,conn,1,1
Copyright 2014-2024 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
$_REQUEST["参数名"],获取请求上来的参数
new PDO("mysql:host=数据库地址;dbname=表名","数据库账号","数据库密码");
prepare("要执行的sql语句")
fetchAll(PDO::FETCH_ASSOC);//获取结果数组
你这个是asp吧, 这个就是一个接收表单发送的数据,然后根据这个数据查询数据库。