-1
if ($stmt = $dbconn->prepare('INSERT INTO `astm_clients_tbl` (`u_name`, `u_email`, `u_password`, `u_plain_password`, `u_phone`, `u_referral_id`, `u_referrer`, `u_join_date`) VALUES (?, ?, ?, ?, ?, ?, ?, ?)')) {
    $stmt->bind_param('ssssssss', $auth_name, $to, $password, $plainPass, $tel, $ref_id, $ref, $join_date);
    $stmt->execute();
    header('Location: register.php?msg=success');
    exit();
    $stmt->close();
} else {
    header('Location: register.php?msg=error');
    exit();
}
Barmar
  • 741,623
  • 53
  • 500
  • 612

1 Answers1

-2

$stmt->execute() returns bool. Check if it's True before redirecting.

Take a cue below

if ($stmt = $dbconn->prepare('INSERT INTO `astm_clients_tbl` (`u_name`, `u_email`, `u_password`, `u_plain_password`, `u_phone`, `u_referral_id`, `u_referrer`, `u_join_date`) VALUES (?, ?, ?, ?, ?, ?, ?, ?)')) {
    $stmt->bind_param('ssssssss', $auth_name, $to, $password, $plainPass, $tel, $ref_id, $ref, $join_date);
    if ($stmt->execute()) {
        header('Location: register.php?msg=success');
        exit();
        $stmt->close();
    }
} else {
    header('Location: register.php?msg=error');
    exit();
}
ForALLs
  • 27
  • 5