I provided code, where first argument is path to image or default NULL in MySQL database,
function formatImage($img = NULL, $alt = NULL)
{
// if(isset($img)) DOESN'T WORK
if(!$img == NULL)
{
return '<img src="' . $img . '" alt="' . $alt .'" />';
}
else
{
return NULL;
}
}
Why isset doesn't work? Instead I have to check if is (!$img == NULL).
In case of using checking argument with isset, and that $img is NULL in database. as output im getting whole HTML IMG tag with empty src attibutes, and alt attribute which is actaully title fetched from database. Setting display property to none to images without src attribute isn't acceptable.
DOESN't WORK- Mosty Mostacho$imgends up containing a string'NULL'- so his approach to using isset() didn't work out that well. - SquareCatvar_dump($img)just before theifwill shed some light here - Mosty Mostacho