ColdFusion Programming/transferring data from database
Expert: Donald Hammond - 11/1/2008
Questionhi,
i want to know how to transfer data from database to the COLDFUSION?
i tried to do it several times like below:
<cfquery name="patient" datasource="whatever">
SELECT *
FROM Patient
</cfquery>
<cfoutput query="patient">
#FirstName##LogonCode
</cfoutput>
but still what happens is when i tried to run it on the browser, rather than
showing the list from database, this is what happen:
#FirstName##LogonCode#
and i need to add new patient as well. thanks
AnswerIf that is your output then it means 1 of 2 things.
1 - You are not on a ColdFusion server
2 - Your page ends in html not cfm ex myPage.html vice myPage.cfm
To insert you have to have a form that takes the data and passes it to the query like
<cfquery name="qInsert" datasource = "myDatasource">
INSERT INTO table
(firstname,lastname)
VALUES
('#form.firstname#','#form.lastname#')
</cfquery>