0

The last if condition is ignored whereas one or both variables are equals to 0, can you explain me why ?

<?php
require('../controller/env.php');
$countexisting=0;
  if(!isset($_GET['idkey'])){
    header('location:../index.php');
    exit();
  }else{
    $idkey=$_GET['idkey'];
    $request=$db->prepare('SELECT * FROM testimonials WHERE idkey=?');
    $request->execute(array($idkey));
    while ($exist=$request->fetch()) {
      $countexisting+=1;
      $activelink = $exist['activelink'];
    }

    if($countexisting=0 || $activelink=0){
      header('location:../index.php');
      exit();
    }
  }

Thanks !

AdBess
  • 11
  • 5

1 Answers1

0

Missed the "==".

if($countexisting==0 || $activelink==0){
      header('location:../index.php');
      exit();
    }

it's working fine now!

AdBess
  • 11
  • 5