Ask a Question related to Coldfusion Database Access, Design and Development.
-
rickaclark54 #1
Updating data sent from Paypal
I have a value sent from paypal that I am trying to insert into an existing
database.
I am trying to call up the data, from the existing database, by the email
address that is sent from Paypal, then update the table with a subscr_id.
Unfortunately, I have been staring at this code for too long. I know it
probably has a simple solution, I just can't see it at this time. Below is the
code I am trying to use:
<cfset
authToken="token number">
<cfset txToken = url.tx>
<cfset query="cmd=_notify-synch&tx=" & txToken &
"&at=" & authToken>
<CFHTTP url="https://www.sandbox.paypal.com/cgi-bin/webscr?#query#"
method="GET"
resolveurl="false">
</CFHTTP>
<cfif left(#cfhttp.FileContent#,7) is "SUCCESS">
<cfloop list="#cfhttp.FileContent#"
index="curLine"
delimiters="#chr(10)#">
<cfif listGetAt(curLine,1,"=") is "first_name">
<cfset first_name=listGetAt(curLine,2,"=")>
</cfif>
<cfif listGetAt(curLine,1,"=") is "last_name">
<cfset last_name=listGetAt(curLine,2,"=")>
</cfif>
<cfif listGetAt(curLine,1,"=") is "item_name">
<cfset item_name=listGetAt(curLine,2,"=")>
</cfif>
<cfif listGetAt(curLine,1,"=") is "mc_gross">
<cfset mc_gross=listGetAt(curLine,2,"=")>
</cfif>
<cfif listGetAt(curLine,1,"=") is "mc_currency">
<cfset mcCurrency=listGetAt(curLine,2,"=")>
</cfif>
<cfif listGetAt(curLine,1,"=") is "subscr_id">
<cfset subscr_id=listGetAt(curLine,2,"=")>
</cfif>
<cfif listGetAt(curLine,1,"=") is "payer_email">
<cfset email=listGetAt(curLine,2,"=")>
</cfif>
</cfloop>
<!---The following piece of code is used to replace the URL encoding -
supposedly the prior code was to decode the string, but is isn't working either
--->
<cfset email = #Replace(email, "%40", "@")#>
<cfset item_name = #Replace(item_name, "+", " ")#>
<!--- here is the code I am using to call up the student_id --->
<cfquery name="qdata" datasource="#application.main#">
select student_id, email, first_name, last_name
from student
where email = '#email#'
</cfquery>
<!-- this is where I am going wrong --->
<cfset subscr_id = #subscr_id#>
<cfupdate datasource="#application.main#" tablename="student"
formfields="student_id,
subscr_id"<cfoutput query="qdata">>
<p><h3>Your order has been received.</h3></p>
<b>Details</b><br>
<ul>
<li>Name: #first_name# #last_name# #student_id#</li>
<li>Subscription id: #subscr_id#</li>
<li>Email: #email#</li>
<li>Amount: #mc_gross# #mcCurrency#</li>
<li>Class: #item_name#</li>
</ul>
<hr>
rickaclark54 Guest
-
Updating components when data changes
I am having trouble getting a set of components to update when data is modified by another set of components. A... -
updating XML data
I have the following code in place to move a variable from my Flash app to an XML file for storage . . . //replace the GoodVN value in the XML... -
Updating the data on a Chart
Hi, I'm trying to invalidate the data of a Chart by calling invalidateData (which is defined in ChartBase and supposedly inherited in PieChart,... -
Updating data in a column using it's own value
I trying to change all the entries in a column of a table to titlecase. I have a custom tag that does the case change but I can't get it to work in... -
Updating Data Using a Subform
On Tue, 8 Jul 2003 12:27:39 -0700, "Brian" <btvisc@hotmail.com> wrote: Base the Subform on a Query with a criterion of on the date/time... -
BKBK #2
Re: Updating data sent from Paypal
<!-- this is where I am going wrong --->
<cfset subscr_id = #subscr_id#>
<cfupdate datasource="#application.main#" tablename="student"
formfields="student_id,
subscr_id"The error arises because you forgot one or both of Coldfusion's requirements>
for cfupdate. First, at least one of the column names must correspond to the
primary key field of the database. Second, cfupdate applies to variables in the
form scope. This should solve the problem assuming, for example, that email is
the DB's primary key :
<cfparam name="form.subscr_id" default="#subscr_id#">
<cfparam name="form.student_id" default="#qdata.student_id#">
<cfparam name="form.email" default="#email#">
<cfupdate datasource="#application.main#" tablename="student"
formfields="student_id, subscr_id,email">
BKBK Guest
-
rickaclark54 #3
Re: Updating data sent from Paypal
I pulled up the primary key in the first query. So, my problem lied with the <cfparam> tag, once I used this tag everything worked fine.
Thank you
Rick
rickaclark54 Guest



Reply With Quote

