0
$query = NULL;
if($formtype == "patient"){
  $query = mysqli_query($conn,"SELECT * FROM patient where email='$id'")or die(mysqli_error());
}
else if($formtype == "donor"){
  $query = mysqli_query($conn,"SELECT * FROM donor where email='$id'")or die(mysqli_error());
}
$row = mysqli_fetch_array($query);

Here is the error:
Here is the error

Dharman
  • 30,962
  • 25
  • 85
  • 135
  • 3
    It is a very bad idea to use `die(mysqli_error($conn));` in your code, because it could potentially leak sensitive information. See this post for more explanation: [mysqli or die, does it have to die?](https://stackoverflow.com/a/15320411/1839439) – Dharman Oct 19 '21 at 08:51
  • I am not sure what you are expecting. You set `$query = NULL;` and if neither of the conditions match then it will remain null. What do you want to do here? – Dharman Oct 19 '21 at 08:57
  • 1
    Are you certain that `$formtype` is actually set and either `patient` or `donor`. If not, `$query` will be null. Is `$conn` set? – brombeer Oct 19 '21 at 08:58
  • Try `var_dump($formtype)` that not set to `patient` or `donor` – Dylan Delobel Oct 19 '21 at 09:00

0 Answers0