I have been looking for an explanation for this, but couldn't find one.
I'm using a Mysql database. In my table I have a column called unitPrice. It's type: decimal(10,2) - unsigned
Now as for my php page:
$price = mysql_result($rows, $tel, "unitPrice");
if(is_null($price ) || $price = ""){
echo " niet ingevuld ";
}else{
echo $price ;
}
The if-tag is completed perfectly. Which lets me believe the value is correctly stored into the variable when it comes to NULL and empty values. Now as for the else-tag, it goes wrong. Normally it should collect the value and store it into $price. Like it did with every single other value I collected previously (but stored in the database with other types) But when I went to check my website page, there was no value!
When I placed:
$price = mysql_result($rows, $tel, "unitPrice");
if(is_null($price) || $price = ""){
echo " niet ingevuld ";
}else{
echo mysql_result($rows, $tel, "unitPrice") ;
}
It showed the result correctly.
It wouldn't be a big problem if it wasn't for the fact that I need the variable somewhere else again and don't wish to keep writing the mysql_result phrase over and over again...
Could anyone please explain why it won't work properly with a variable? And perhaps give me a solution as to how to make it work with a variable?
My apologies if this has been answered before. I've looked around for a while, but couldn't find any answers.