Results 1 to 2 of 2
Thread: Invalid column name?!
-
01-09-2010, 02:58 PM #1
Invalid column name?!
Hello everyone,
I'm passing a variable over a URL. The value is user01.
The problem is that an error message occurs stating that there is an incorrect column name?! Here is the code below and the error message:
<cfquery name="userQuery" datasource="xxxxx" username="xxxxx" password="xxxxx">
SELECT admin FROM users WHERE username="#url.promo#"
</cfquery>
It comes up with the following error:
[Macromedia][SQLServer JDBC Driver][SQLServer]Invalid column name 'user01'.
Please help.
Many thanks in advance,
-
02-02-2010, 11:39 AM #2
<cfquery name="userQuery" datasource="xxxxx" username="xxxxx" password="xxxxx">
SELECT admin
FROM users
WHERE username= <cfqueryparam cfsqltype="cf_sql_varchar" value="#url.promo" />
</cfquery>
This should help you out. It is good practice to use cfqueryparam to help with SQL injection.
Similar Threads
-
Frame height problem
By hilda_mateiu in forum HTML / DHTMLReplies: 14Last Post: 05-16-2012, 03:15 AM -
Variable Column Name - MS SQL
By manik in forum DatabasesReplies: 3Last Post: 12-13-2010, 01:05 PM -
Released another website
By logic in forum ReviewsReplies: 8Last Post: 03-03-2010, 11:28 AM -
Query Separating Value from a single column in database
By Abina in forum ColdFusionReplies: 1Last Post: 01-31-2010, 11:11 AM -
3 Column Layout with Bottom Positioned Footer
By manik in forum CSSReplies: 0Last Post: 08-27-2008, 10:47 PM




Reply With Quote

