Jump to content

How to update users in the DB by their email/id


Burton

Recommended Posts


I want to update users when they purchase premium by their email OR database ID, either one would work, BUT the only way it's working for me at the moment is by me entering their ID in the $_SESSION at the top. I want the page to get the users ID OR email after they purchase. I have asked this many places and have got no answer, people basically tell me to just type it. That would be crazy to do that for every single user.

 

If you have an answer, PLEASE! I literally beg for you to copy the code above and place stuff where it needs to be, I've been stuck for days/weeks. I've tried EVERYTHING, except the right thing. Nothing is working for me on this, I also can't find anything on Google about it. I'm not an expert with PHP, so I may be missing bits, if I am, feel free to tell me I'm doing it wrong and let me know what I need to do.

<?phprequire_once ('vendor/autoload.php');$_SESSION['user_id'] = '?';$stripe = array(    "secret_key" => "sk_test_vDYOBYxCErhrgGCeWQJhR4mQ",    "publishable_key" => "pk_test_4mIuE3OsajKO4cnFppcDDISu"    );        StripeStripe::setApiKey($stripe['secret_key']);$db = new PDO('mysql:host=127.0.0.1;dbname=blog', 'root', '');$userQuery = $db->prepare("    SELECT id, username, email, premium    FROM users    WHERE id = id    ");        $userQuery->execute(['user_id' => $_SESSION['user_id']]);        $users = $userQuery->fetchObject();
Edited by Burton
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...