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();