tommyinnn Posted February 5, 2009 Share Posted February 5, 2009 should be simple..right?? well, for some reason I can't figure this out, not sure what to google either! in most cases, I have no problem with if/else commands, but what if the variable is NULL, but if($image === "NULL") but NULL doesn't work neither does if($image === " ") or if($image > NULL) etc., etc. it's a image from a API, if there is not a image (image url) then display nothing if there is, display the image Does anyone know of any other code that may help?? here's what the XML file looks like when there is no image <ReferencesCount>49</ReferencesCount> <ImageUrl/> <FirstName>John</FirstName> and what it looks like if there is a image <ReferencesCount>186</ReferencesCount> − <ImageUrl> http://www.zoominfo.com/Search/PersonImage.aspx?DefaultImageSource=http://www.zoominfo.com/images/transparent.gif&AccountID=5108&ImageSource=http://www.zoominfo.com/About/i/photo_yonatan.jpg </ImageUrl> <FirstName>Jonathan</FirstName> SEE what's missing?? (it's from the zoomInfo.com API) and here is the problem with the images i-locate.info/zoom.php thanks for any help any one can give!! Quote Link to comment https://forums.phpfreaks.com/topic/143872-ifelse-help/ Share on other sites More sharing options...
Philip Posted February 5, 2009 Share Posted February 5, 2009 in most cases, I have no problem with if/else commands, but what if the variable is NULL, but if($image === "NULL") but NULL doesn't work neither does if($image === " ") or if($image > NULL) Well, first you're using the exact comparison, when really a normal comparison (==) would do fine. Next, "NULL" shuld be NULL, without quotes. Finally, why not just use the is_null() function? Quote Link to comment https://forums.phpfreaks.com/topic/143872-ifelse-help/#findComment-755047 Share on other sites More sharing options...
tommyinnn Posted February 5, 2009 Author Share Posted February 5, 2009 Thanks for the response, yes, I tried if($image === "NULL") , if($image === NULL ) , if($image === 'NULL') , if($image > 1) , if($image === 1) , etc, etc, etc... and the is_null() didn't work either.. I read this entire page http://us2.php.net/is_null 3 times and tried several examples, nothing... any other ideas!??? Quote Link to comment https://forums.phpfreaks.com/topic/143872-ifelse-help/#findComment-755181 Share on other sites More sharing options...
ashishag67 Posted February 5, 2009 Share Posted February 5, 2009 I suggest try if(!isset($image)) or if($image=="") Quote Link to comment https://forums.phpfreaks.com/topic/143872-ifelse-help/#findComment-755191 Share on other sites More sharing options...
RichardRotterdam Posted February 5, 2009 Share Posted February 5, 2009 Later on in your topic you mention an xml file. What exactly gets stored in the $image var? could you show the code with what you assing the value to the $image var Quote Link to comment https://forums.phpfreaks.com/topic/143872-ifelse-help/#findComment-755329 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.