473,387 Members | 1,540 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

How to update users in the DB by their email

1
I'm trying to get a users email so it will update them when they purchased premium, I'm using Stripe as my payment system. The only way I can get it to work, is if I insert their email/id into my php page. I'm wanting the page to get the users email on it's on.

Expand|Select|Wrap|Line Numbers
  1. $_SESSION['user_id'] = 9;
  2.  
  3. $stripe = array(
  4.     "secret_key" => "sk_test_rDYOBYxCErhrgGCeWQJhR4mQ",
  5.     "publishable_key" => "pk_test_3mIuE3OsajKO4cnFppcDDISu"
  6.     );
  7.  
  8.     \Stripe\Stripe::setApiKey($stripe['secret_key']);
  9.  
  10. $db = new PDO('mysql:host=127.0.0.1;dbname=blog', 'root', '');
  11.  
  12. $userQuery = $db->prepare("
  13.     SELECT id, username, email, premium
  14.     FROM users
  15.     WHERE id = :user_id
  16.     ");
  17.  
  18.     $userQuery->execute(['user_id' => $_SESSION['user_id']]);
  19.  
  20.     $users = $userQuery->fetchObject();
  21.  
I'm using ID's right now, I have to enter them on my own. The website isn't live, just testing. I can get the users email with Stripe on my checkout page by putting

Expand|Select|Wrap|Line Numbers
  1. echo $users->email
& the email shows up on the purchase screen, where normally they would have to type it. I'm not sure how to get it on purchase so it will update the user in the DB though.
Apr 17 '15 #1
0 1033

Sign in to post your reply or Sign up for a free account.

Similar topics

5
by: R Duncan | last post by:
Hi, I'm considering moving a payroll application out of Microsoft Access to some web-based solution. It is getting way to big for Access and the system is growing unstable, so I'm learning PHP...
1
by: revolnip | last post by:
As attached is the code : <% Option Explicit dim lngTimer lngTimer = Timer %> <!--#include file="Connect.asp" --> <!--#include file="Settings.asp" --> <!--#include file="Common.asp" -->
0
by: rod | last post by:
Hello, I have a client with a 100 letters pertaining to a specific industry that they want to publish using a website. The process wanted, whereby the surfing client can click on a letter and go...
24
by: Arno R | last post by:
Hi all, I have a client with several shoe-shops. Customers can leave their email-address if they want to be notified when there is a sale. Input is validated with instr() I am checking for @...
2
by: KS Tan | last post by:
Hello support, I need help to have asp code to send email to the users. My scenario is like this: An Access database is created to look detect whether the database records not update, then an...
1
by: Yousef Altaf | last post by:
I have this code (it's a form which will sign up new users and send them an email to active they account). <?php if(isset($_POST)) { $msg=""; $RFname =...
11
by: imahhua | last post by:
I am not a programmer and I usually use macro to fulfill some small functions. This time I use a Macro of "SendObject" to send report as Pdf format. it is working well when I test it while...
5
by: notfound | last post by:
Here is my part of php code.In this code when a user clicks the edit EditProfile.php is opened.And when the user change his or her info and type the button update the info is coming from the...
1
by: ScottDay96 | last post by:
I am currently helping to run a gaming forum using vBulletin 4.2.2 and am hoping to give certain updates. One main update I would like to attempt to enable is for each user to have their own 'User...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.