PHP Help!

So i have this code for activating an account on my website (don’t judge I have only just started to code). It’s giving no errors but nothing is happening.

[php]

<?php session_start(); $email = ""; $hash = ""; $confirmcode = ""; if(isset($_GET['email'])) $email = $_GET['email']; if(isset($_GET['hash'])) $hash = $_GET['hash']; if(isset($_GET['code'])) $confirmcode = $_GET['code']; require_once 'connect.php'; $sql = "SELECT * FROM users WHERE email = 'email' AND hash = 'hash' AND confirmcode = 'confirmcode'"; $result = mysqli_query($dbc,$sql); if($result) { $sql = "UPDATE users SET confirmed = 1 WHERE hash = '$hash' AND cofirmcode = '$confirmcode'"; $result = mysqli_query($dbc,$sql); if($result) { echo "

Email Activated!

Go to home"; } else echo "

Sorry we couldn't activate this email!

"; echo "$hash, $confirmcode, $email"; // I get this part. This is the only 'Error' I get. } ?>

[/php]

Thanks In Advance

This does nothing,
[php]$sql = “SELECT * FROM users WHERE email = ‘email’ AND hash = ‘hash’ AND confirmcode = ‘confirmcode’”;[/php]

And this should not be done,
[php]$sql = “UPDATE users SET confirmed = 1 WHERE hash = ‘$hash’ AND cofirmcode = ‘$confirmcode’”;[/php]

Since you are just starting, start the better way and learn PDO. This will get you going.
https://phpdelusions.net/pdo

Sponsor our Newsletter | Privacy Policy | Terms of Service