php qq在线客服代码:网页数据库问题

来源:百度文库 编辑:高校问答 时间:2024/05/04 19:14:40
我刚学网页数据库,发现建立一个数据库联接后,对表中数据项选择语句
exec="select * from telbook where name=request.form("name")"
这样的语句不能用
我想用上个网页表单发过来的name数据中此条件的
数据库中此记录,应该怎么写呀
谢谢

有区别的,如果是name是数字的话

exec="select * from telbook where name = "&request("name")
如果name是文字的话
必须这样写
exec="select * from telbook where name =' "&request("name")&" ' "
(你直接在SQL查询管理器上使用过就知道了)

全文.

exec="select * from telbook where name='"&request.form("name")&"'"

你的参数写的不对,这样写比较好:

dim m_name
m_name = trim(request.form("name"))
exec = "select * from telbook where name = " & m_name