Here some my code for see if boolean is 1 then go to google.com.
if(isset($_POST['submit']))
{
$acc_num = $_POST['acc_num'];
}
$sql = "SELECT * FROM security_protocol WHERE acc_num='$acc_num'";
$result = mysqli_query($con, $sql);
if (mysqli_num_rows($result) > 0) {
// output data of each row
while($row = mysqli_fetch_assoc($result)) {
$boolean =$row["boolean"];
if($boolean > 1) {
$t_slot_times = $t_slot_time + 1;
for ($i = 1;$i<=20;$i++)
{
header("Location: google.com");
}}}
I can't post a comment yet, so I'll show you what I understood from your question.
There are a couple of things I would like to tell you:
if(mysqli_num_rows($result) > 0)
statement.$i
and why does the for loop loop 20 times?$_POST
variable or use prepared statements to prevent SQL injection.$t_slot_times
store?Here's what I have for you right now:
if(isset($_POST['submit'])) {
$acc_num = $_POST['acc_num'];
$acc_num = mysqli_real_escape_string($acc_num);
}
$sql = "SELECT * FROM security_protocol WHERE acc_num='$acc_num'";
$result = mysqli_query($con, $sql);
if (mysqli_num_rows($result) > 0) {
// Go trough the received data
while($row = mysqli_fetch_assoc($result)) {
$boolean = $row["boolean"];
if($boolean == 1) {
$t_slot_times = $t_slot_time + 1;
header("Location: google.com");
}
}
}
It will be much easier to help you if you could give us more information.