Search forums only
Search forums only
Adobe Creative Cloud
Downloading, Installing, Setting Up
Adobe Experience Cloud
Adobe Flash Player
Adobe Photoshop Lightroom
Adobe Photoshop Elements
Adobe Animate CC
Adobe Premiere Pro
Adobe After Effects
View all communities
Meet the experts
Learn our products
Get inspired in the lounge
Read the blog
Please enter a title.
You can not post a blank message. Please type your message and try again.
on May 20, 2007 1:56 PM by JohnGree
May 18, 2007 7:40 AM
Hi i have a payment table, when a user pays for our service the details get inserted into.
I have ClientID, Amount, CostPerUnit as my columns
say i have the clientID as 34 who has an Amount of 1000 and a PerUnit is 0.12
and the i have the same client 34 with Amount of 250 and a PerUnit is 0.17
what i need to do is insert the perunit cost into my records table everytime a unit has been used
insert into Records
(CientID, Cost, ClientCostPerSMS)
('#session.ClubLogin#', 1', UNITCOST)
but before i insert it i need to know which unit cost to insert, so i have a session which tells me how many uints they have left
how can i have a query which selects the first record by ClientID and if the '#session.TotalSMSLeft#' is more than the Amount to select the next record an so on....
<CFQUERY datasource="#application.ds#" Name="GetPayInfo">
WHERE ClientID = #ClientIDD#
I have the same question
Show 0 Likes
This content has been marked as final.
Show 2 replies
Re: loop query
May 20, 2007 7:07 AM
in response to JohnGree
where clientid = #session.clublogin#
where amount > #session.totalsmsleft#
order by amount
You want row 1 of the result. You need more code to cope with 1st records per client and stuff like that.
May 20, 2007 1:56 PM
in response to Dan Bracuk
ok yes that will work, but how do i code if the session.totalsmsleft is more than the amount from that query,
then i need to find the next record with the clientid and do the same query again
so if the amount inthe query is 3000
and the session is 5000
i need to do is add up the amounts until the 5000 is reached
so if i have 3 records from the same client of 1000, 3000, 2000
i need to add 1000 plus 3000 plus 2000 then the session of 5000 will be less so the record of 2000 would be the one i need to use.
do i need to do a loop?
Go to original post
More Like This
Retrieving data ...
- 10 points