0
Participant
,
/t5/coldfusion-discussions/passing-a-simple-id-via-url-using-a-hyperlink-problem/td-p/330756
Mar 26, 2009
Mar 26, 2009
Copy link to clipboard
Copied
I can't believe I can't figure this one out, I am passing an
id via the url variables using a hyper link. It comes back with an
error in my linked page saying there is an error in the way I used
a function. I don't get it, it's a function I use all the time.
Here is my queries that are passing and receiving the id.
indexpage:
<cfquery name="useRec" datasource="#APPLICATION.dataSource#">
SELECT user.Fname AS ViewField1, user.email AS ViewField6, user.Lname AS ViewField3, user.userName AS ViewField4, user.password AS ViewField5, lastLogin, hits, user.ID AS ID
FROM user
</cfquery>
<cfoutput query="useRec">
<a href="page2.cfm?ID=#ID#" class="nav">View user Record</a>
</cfoutput>
PAGE 2
<cfparam name="ID" type="integer" default="#url.ID#">
<cfquery name="useRec" datasource="#APPLICATION.dataSource#">
SELECT user.Fname AS ViewField1, user.email AS ViewField6, user.Mname AS ViewField2, user.Lname AS ViewField3, user.userName AS ViewField4, user.password AS ViewField5, user.admin AS ViewField6 user.lastLogin AS lastLogin, user.hits AS hits, user.ID
FROM user
<cfif isDefined("URL.ID")>
WHERE ID = <cfqueryparam value="#URL.ID#" cfsqltype="cf_sql_integer">
</cfif>
</cfquery>
this is my error:
Error Executing Database Query. [Macromedia][SequeLink JDBC Driver][ODBC Socket][Microsoft][ODBC Microsoft Access Driver] The SELECT statement includes a reserved word or an argument name that is misspelled or missing, or the punctuation is incorrect.
The error occurred on line 11.
It is throwing an error on my if statement. I have tried a number of different options and still the same error.
Can anyone see what I might have missed?
Thank you.
indexpage:
<cfquery name="useRec" datasource="#APPLICATION.dataSource#">
SELECT user.Fname AS ViewField1, user.email AS ViewField6, user.Lname AS ViewField3, user.userName AS ViewField4, user.password AS ViewField5, lastLogin, hits, user.ID AS ID
FROM user
</cfquery>
<cfoutput query="useRec">
<a href="page2.cfm?ID=#ID#" class="nav">View user Record</a>
</cfoutput>
PAGE 2
<cfparam name="ID" type="integer" default="#url.ID#">
<cfquery name="useRec" datasource="#APPLICATION.dataSource#">
SELECT user.Fname AS ViewField1, user.email AS ViewField6, user.Mname AS ViewField2, user.Lname AS ViewField3, user.userName AS ViewField4, user.password AS ViewField5, user.admin AS ViewField6 user.lastLogin AS lastLogin, user.hits AS hits, user.ID
FROM user
<cfif isDefined("URL.ID")>
WHERE ID = <cfqueryparam value="#URL.ID#" cfsqltype="cf_sql_integer">
</cfif>
</cfquery>
this is my error:
Error Executing Database Query. [Macromedia][SequeLink JDBC Driver][ODBC Socket][Microsoft][ODBC Microsoft Access Driver] The SELECT statement includes a reserved word or an argument name that is misspelled or missing, or the punctuation is incorrect.
The error occurred on line 11.
It is throwing an error on my if statement. I have tried a number of different options and still the same error.
Can anyone see what I might have missed?
Thank you.
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
1 Correct answer
LEGEND
,
Mar 26, 2009
Mar 26, 2009
your table name - USER - is very likely a reserved word in
your database.
try using it in square brackets: [user]
btw, since you are selecting from only one table, you do not need to
prefix every column name with table name...
Azadi Saryev
Sabai-dee.com
http://www.sabai-dee.com/
try using it in square brackets: [user]
btw, since you are selecting from only one table, you do not need to
prefix every column name with table name...
Azadi Saryev
Sabai-dee.com
http://www.sabai-dee.com/
LEGEND
,
/t5/coldfusion-discussions/passing-a-simple-id-via-url-using-a-hyperlink-problem/m-p/330757#M29926
Mar 26, 2009
Mar 26, 2009
Copy link to clipboard
Copied
your table name - USER - is very likely a reserved word in
your database.
try using it in square brackets: [user]
btw, since you are selecting from only one table, you do not need to
prefix every column name with table name...
Azadi Saryev
Sabai-dee.com
http://www.sabai-dee.com/
try using it in square brackets: [user]
btw, since you are selecting from only one table, you do not need to
prefix every column name with table name...
Azadi Saryev
Sabai-dee.com
http://www.sabai-dee.com/
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
LEGEND
,
/t5/coldfusion-discussions/passing-a-simple-id-via-url-using-a-hyperlink-problem/m-p/330758#M29927
Mar 26, 2009
Mar 26, 2009
Copy link to clipboard
Copied
Azadi answered your question. My general suggestion is to
start paying closer attention to your error messages. For some
reason, you misinterpreted the one you got big time.
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
CFmonger
AUTHOR
Participant
,
LATEST
/t5/coldfusion-discussions/passing-a-simple-id-via-url-using-a-hyperlink-problem/m-p/330759#M29928
Mar 26, 2009
Mar 26, 2009
Copy link to clipboard
Copied
Yes he did. I also found that I missed a comma in my query.
It is all fixed now. I had to walk away from it for a couple of hrs
to find it.
Thank you for the help.
Thank you for the help.
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more

