ianhaney Posted December 31, 2015 Share Posted December 31, 2015 Hi I have created a site that when users are logged in, they click a link which takes them to PayPal to pay and then returned to a form page to fill out a job advert, it all works perfect apart from one little issue I have after they submitted the job advert form and is added to the db, they close the page after logging out and then open that page again, they can add another job advert again without paying so was seeing if there is any coding that checks if they have not paid and it redirects them to a error page if they not paid and try accessing the job advert form page Hope that makes sense Thank you in advance Ian Quote Link to comment Share on other sites More sharing options...
ianhaney Posted December 31, 2015 Author Share Posted December 31, 2015 (edited) This is the script I am using that works apart from the return url issue where they can access the return url again without paying so need a way of checking if the user has paid or not http://www.sanwebe.com/2012/07/paypal-expresscheckout-with-php Edited December 31, 2015 by ianhaney Quote Link to comment Share on other sites More sharing options...
ianhaney Posted December 31, 2015 Author Share Posted December 31, 2015 Think I figured a way round it but unsure how to code it in BuyerTable I have added a paid and complete column so when the payment is made via PayPal the paid column gets updated to a 1 for Yes, I have set it to default of 0 for No and then when they submit the job advert the complete column gets updated to a 1, again I have set that to a default of 0 it's the coding where I am getting stuck, I am completing the payment and takes me to the return url but the paid column is not being updated to a 1 below is the coding I have from my process.php file that does the PayPal API that adds the transaction to the db $insert_row = $mysqli->query("INSERT INTO BuyerTable (BuyerName,BuyerEmail,TransactionID,ItemName,ItemNumber,ItemAmount) VALUES ('$buyerName','$buyerEmail','$TransactionID','$ItemName','$ItemNumber', '$ItemTotalPrice')"); $update_row = $mysqli->query("UPDATE BuyerTable SET paid = 'Y' WHERE TransactionID = '$TransactionID'"); Quote Link to comment Share on other sites More sharing options...
ianhaney Posted December 31, 2015 Author Share Posted December 31, 2015 Sorry made a slight adjustment in the UPDATE query to the following UPDATE BuyerTable SET paid = '1' WHERE TransactionID = '$TransactionID' but it is not updating the paid column Quote Link to comment Share on other sites More sharing options...
ianhaney Posted December 31, 2015 Author Share Posted December 31, 2015 Sorry I been playing around with it more and modified the UPDATE query some more and it updates to 1 so think I sussed it if someone can confirm it is correct or if is a batter way etc UPDATE BuyerTable SET paid = 1 WHERE buyerEmail = '$buyerEmail' Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.