I want to make a link to another page based on the value inside database column.
table member
user_id name point
--------------------------
1 sid 90
2 mike 100
3 john 110
for example, if we click this link <a href="chkpoint.php?user_id=<?php echo $row['user_id']; ?>" >Buy</a>
it will check value in point column, if the value are below or equal than 100 it will go to page buy1.php
else it will go to topup.php
. so base on table above, for sid click Buy link, he will go to topup.php
and for mike and john click Buy link they will go to buy1.php
. so how can i create chkpoint.php
? so far this is my code for chkpoint.php
<?php
$conn = new PDO('mysql:host=xxx; dbname=xxx', 'xxx', '') or die(mysql_error());
if (isset($_GET['user_id']) && !empty($_GET['user_id'])) {
$user_id = $_GET['user_id'];
$stmt = $conn->prepare('SELECT * FROM member WHERE user_id =:user_id');
$stmt->execute(array(':user_id'=>$user_id));
$row = $stmt->fetch(PDO::FETCH_ASSOC);
extract($row);
} else {
header("Location: memrec.php");
}
if (isset($_GET['point']) <= "100") {
header("Location: topup.php");
} else {
header("Location: buy1.php");
}
?>
but that code above doesn't working.