/    Sign up×
Community /Pin to ProfileBookmark

Not sure how to Title this

I have a mysql database that a user will enter information into via a php form. The form uses sessions and puts the session username into a database field named username. I also have a field named “show_ad” that is set to “no” through a hidden field.

I don’t have a shopping cart system instead I use a PayPal buy-now button that the user has to click on, which takes them to PayPal’s site where they pay for the ad they just entered. I use PayPal IPN so they will send my server a code that populates three database tables on my server that they supplied the script for. The information pertains to the payment and the user that paid.

On one of the table is a couple of fields named “paymentstatus” and “txnid”. If the payment was completed without any problems it is entered into the “paymentstatus” field and I’m guess a unique transaction id goes into the “txnid” field.

I’m not sure how to do this but I want to changed the field “show_ad” in my ads table from “no” to “yes” if the payment status sent from PayPal is “completed”. My original thought was to add a snippit of code to the bottom of the IPN php code that PayPal gave me that puts information into their tables, to also update my “show_ad” field in the “ads” table from “no” to “yes”, if the PayPal “paymentstatus” result was “complete”.

On the front side where I display all the ads, the code condition is if “show_ads” = “yes” then display ad.

The problem of course is how would the PayPal IPN code know which ad entry to update the “show_ad” field to “yes”? Is there a way to attach the session username and unique id number to go along to PayPal’s site while the user makes payment and then use it to to update the correct ad entry when they get back to my site?

Any ideas as to how I can accomplish what I’m trying to do.

to post a comment
PHP

0Be the first to comment 😎

×

Success!

Help @Alan_P spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.19,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...