我有以下代码,它应该根据他们的停车许可证号码获取学生信息:
<cfparam name="Permit" default="">
<cfquery name="q_sample" datasource="cars_live">
SELECT * FROM veh_rec WHERE UPPER(DECAL) LIKE <cfqueryparam cfsqltype="cf_sql_varchar" value="#trim(urldecode(UCase(Permit)))#">
</cfquery>
<cfif q_sample.recordcount eq 0>
No Results found for <cfoutput>"#Permit#"</cfoutput>
</cfif>
<cfquery name="s_sample" datasource="cars_live">
SELECT FULLNAME FROM id_rec WHERE ID = #q_sample.ID#>
</cfquery>
<cfoutput query="s_sample">
<p>Name: #FULLNAME#<p>
</cfoutput>
<cfoutput query="q_sample" >
<p>License Plate Number: #license# <br><br> Permit ID Number: #decal#<br><br> Student ID Number: #ID# <br><br> Academic years: #ACADYR#<br><br></p>
</cfoutput>
车牌、许可证 ID 号等都可以正常工作,但是当我尝试使用 #q_sample.ID# 标记时,出现语法错误。但是,当我查看 chrome 控制台窗口中的错误时,我可以看到它正在根据许可证号获取正确的 ID。不知道为什么会这样。有谁看到我做错了什么?
谢谢!
按照要求:
错误:
The web site you are accessing has experienced an unexpected error.
Please contact the website administrator.
The following information is meant for the website developer for debugging purposes.
Error Occurred While Processing Request
Error Executing Database Query.
A syntax error has occurred.
The error occurred in /d2/www/vhosts/joeyP.cfm: line 11
9 : 10 : <cfquery name="s_sample" datasource="cars_live">11 : SELECT FULLNAME FROM id_rec WHERE ID = #q_sample.ID#>12 : </cfquery>13 :
VENDORERRORCODE -201
SQLSTATE 42000
SQL SELECT FULLNAME FROM id_rec WHERE ID = 371043>
DATASOURCE cars_live
Resources:
Check the ColdFusion documentation to verify that you are using the correct syntax.
Search the Knowledge Base to find a solution to your problem.
Browser Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/27.0.1453.110 Safari/537.36
Remote Address 10.200.168.210
Referrer http://{redacted}/tests/yup.html
Date/Time 10-Jun-13 09:17 AM
Stack Trace
at cfjoeyP2ecfm876470777.runPage(/d2/www/vhosts/joeyP.cfm:11) at cfjoeyP2ecfm876470777.runPage(/d2/www/vhosts/joeyP.cfm:11)
我正在测试的号码是 371043