i have the if statement below i am trying to make sure that the variable client2 is not empty before doing the update, as the update has to be performed to that client, but ever time i uncomment the if statement it gives a white screen
if(!empty($client2)
{
mysqli_query($con,$query) or die ("Could not update ");
header('Location: preview.php?=client=$client');
}
what i would like is for it not to produce a white screen i suspect it is minor error i have overlooked
the problem also existed before i added
header('Location: preview.php?=client=$client');
this was added as it the final step it needs to do after doing the update but i will have to add a check in to display the error if it fails the update before doing the header but for now i am focusing on getting it to do the update regardless of mysql errors
You do miss a closing bracket in your if. Empty is a function and needs to be opened and closed with brackets (). As is the IF function. In other words, you don't close your IF function so PHP assumes that everything after emtpy() is still part of the IF closure.
Also, try never working (in development env ofc) without display_error being abled.
Besides that, your header function has a '=' after the question mark. Its not needed and will eventually fail.
Your header is wrong you should do it like this:
header("Location: preview.php?client=$client");
You've also forgot a )
here:
if(!empty($client2))