我正在开展项目,我必须搜索名字,电子邮件和建筑物。如果我在这四个框之一中输入任何字母,我应该限制我对该URL参数的查询。我已经创建了我的查询,为整个表创建XML输出。
这是我的代码:
<?xml version="1.0" encoding="utf-8"?><cfsilent>
<cfquery name="myQuery" datasource="Customers">
Select Email, FirstName, LastName, d.BuildingName, Active
From Customers s Join Building d
On s.Building = d.Building
Where Active > 0 and FirstName = %something% or LastName = %something% or Email = %something% or BuildingName = %something%
</cfquery>
<cfsetting showDebugOutput="No">
<!--- These are standard elements which can be inserted back into a request --->
</cfsilent>
<livelookup version="1.0" columns="first_name,last_name"><cfoutput query="myQuery">
<customer>
<customer_id>#XMLFormat(BuildingName)#</customer_id>
<first_name>#XMLFormat(FirstName)#</first_name>
<last_name>#XMLFormat(LastName)#</last_name>
<email>#XMLFormat(Email)#</email>
</customer></cfoutput>
</livelookup>
答案 0 :(得分:2)
关于新问题,以下是获取数据的方法。
where firstName = <cfqueryparam
cfsqltype="cf_sql_varchar"
value = "#url.firstname#">
等
仍然是一次性主题的一步,在担心格式化结果之前,获取sql,coldfusion,无论什么东西正常工作都是个好主意。