Jump to content

if...else help


tommyinnn

Recommended Posts

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!!

 

 

Link to comment
https://forums.phpfreaks.com/topic/143872-ifelse-help/
Share on other sites

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?

Link to comment
https://forums.phpfreaks.com/topic/143872-ifelse-help/#findComment-755047
Share on other sites

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!???

Link to comment
https://forums.phpfreaks.com/topic/143872-ifelse-help/#findComment-755181
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.