Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Text field to cfquery

Status
Not open for further replies.

Guest_imported

New member
Joined
Jan 1, 1970
Messages
0
I've got a text field. Can i get the entered value in a CFquery tag?

Like:

The user filled the text field (named: textfield) with: "hello"

In the CFQuery tag:
<cfquery datasource=&quot;FAQ&quot;>
DELETE FROM FAQ WHERE key = ?textfield?
</cfquery>

so the record with &quot;hello&quot; (key) will be deleted.

what do i have to fill in to get the variable of the text field in my cfquery tag?
 
You are on the right track -- it would be :

For numbers:
<cfquery datasource=&quot;FAQ&quot;>
DELETE FROM FAQ WHERE key = #form.textfield#
</cfquery>

If &quot;key&quot; in the DB is text field, then you would need quotes around it:

<cfquery datasource=&quot;FAQ&quot;>
DELETE FROM FAQ WHERE key = '#form.textfield#'
</cfquery>

HTH,
Tim P.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top