YetAnotherForum
Welcome Guest Search | Active Topics | Log In | Register

filling database with coldfusion not working Options
rickaclark
#1 Posted : Tuesday, December 27, 2005 8:43:08 PM
Rank: Starting Member

Groups: Registered

Joined: 12/22/2005
Posts: 2
Location: ,
Try as I may, I cannot get my script to write to a database. I am able to get my ipn script to write to a txt file. However, I am more concerned about writing my data to a database.The script below works fine writing to a text file. But how do I write to a database? <cfset paypal_url="http://www.sandbox.paypal.com/cgi-bin/webscr"> <!--- Loop through ipn response and post back variables ---> <cfhttp url="#paypal_url#" method="post"> <cfloop collection="#Form#" item="i"> <cfhttpparam type="formfield" name="#LCase(i)#" value="#Form[i]#"> </cfloop> <cfhttpparam type="formfield" name="cmd" value="_notify-validate"> </cfhttp> <!--- Parse IPN Response ---> <cfif ReFindNoCase("VERIFIED","#CFHTTP.FileContent#")> <cfinclude template="ipn_success.cfm"> <cfelse> <cfinclude template="ipn_error.cfm"> </cfif> <cfset postData=""> <cfloop index="i" list="#Form.FieldNames#"> <cfset postData=#postData# & #Form[i]# & ","> </cfloop> <!--- Write Log ---> <cflock name="paypal_lock" type="exclusive" timeout="30"> <cffile action="append" file="#GetDirectoryFromPath(GetTemplatePath())#logs/ipn_success.txt" mode="777" output="#postData#" addnewline="yes"> </cflock> I tried removing the above write log and enter the following code: <cfquery name="qInsertCustomer" datasource="#application.main#"> INSERT INTO Customers( first_name, last_name, email, address, city, state, zip, payer_id, ) VALUES( '#FORM.first_name#', '#FORM.last_name#', '#FORM.payer_email#', '#FORM.address_street#', '#FORM.address_city#', '#FORM.address_state#', '#FORM.address_zip#', '#FORM.payer_id#', ) </cfquery> Any suggestiosn or direction would be greatly appreciated. One desperate dude, Rick
Sponsor  
 
ziggyziggy
#2 Posted : Friday, December 30, 2005 2:51:05 AM
Rank: Starting Member

Groups: Registered

Joined: 12/19/2005
Posts: 15
Location: ,
No commas after the last items in the query. (I do that all the time too!)

INSERT INTO Customers(
...
payer_id,
)
VALUES(
...
'#FORM.payer_id#',
)
Users browsing this topic
Guest
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

YAFVision Theme by Jaben Cargman (Tiny Gecko)
Powered by YAF | YAF © 2003-2009, Yet Another Forum.NET
This page was generated in 0.226 seconds.