500 Error caused by !="" check
Im getting an 500 Error when running this code:
foreach($services as $service)
{
if(isset($service['value'] and $service['value']!=""))
{
echo $service['service']." = ".$service['value']."<br/>";
}
}
When i remove this part: and $service['value']!=""
of the initial IF, The error is gone.
But i need this check to be sure im not inserting empty values into the Database.
I also tried the is_null() function but im still getting the error.
By the way, the Echo is just for debugging, it is not going to be in the finished code
I dont really know what is causing this Error... Maybe someone can help me here ;)
It is a matter of parentheses:
if(isset($service['value']) and ($service['value'] != ""))
You were trying to test isset of an AND
condition, which cannot be done. You have to test isset()
then test value.
上一篇: 为什么我的不是(!)意外?
下一篇: 由于!=“”检查导致的500错误