I am using php and mysql to create a website for medical purposes. A user is able to create an account upload medical documents and the admin of the website can review the users registered information and chose to approve or not approve the user. The below code is used to only give access to a mini online shop only if a user is approved by the admin, what i am trying to figure out now is how to redirect the user back to the user page if they input the online store url manually if there not approved users. The below code is also giving me this error but is working perfectly "Warning: mysqli_stmt::bind_param(): Number of variables doesn't match number of parameters in prepared statement in C:\xampp\htdocs\web-project-medical\user-page.php on line 50"
<?php
$sql_con = new mysqli('localhost', 'root', '' , 'medical_db');
if($stmt = $sql_con->prepare("SELECT approved FROM users WHERE approved = 'Approved'")) {
$stmt->bind_param("s", $Approved);
$stmt->execute();
$stmt->bind_result($Approved);
while ($stmt->fetch()) {
echo '<a href="products.php">store access</a>';
}
$stmt->close();
}
?>