![]() |
| CFIF Statement Question |
|
yobri
|
I am trying to have an image be displayed if a specified field in the database has data in it. I was looking for a IS NOT BLANK or something to that effect in Cold Fusion but I don't see that it exists. It should be a very easy solution.
I simply want CFIF statement that says if the field has URL data in it that i needs to display the image in the URL otherwise show nothing. Any criteria with the CFIF to work through this? |
||||||||||||
|
|
|||||||||||||
|
Jason101
Forum Regular
|
No Problem..
Lets say your field is called MyQuery.Image
What this does is it checks the length of the data in the field. If it's 0, then it does not display an image. If it's NOT 0 in length, it will display the image. You could also specify a length:
Hope this helps |
||||||||||||||||
|
|
|||||||||||||||||
| Solution |
|
yobri
|
I was able to find an even simpler solution...lol
<CFIF #img2# EQ""> that pretty much sums it up...thanks for your reply though. |
||||||||||||
|
|
|||||||||||||
| Re: Solution |
|
Jason101
Forum Regular
|
Just a coding tip.. You don't need to use "#" 's within any Coldfusion tags. Only during <cfoutput> |
||||||||||||||
|
|
|||||||||||||||
|
emmet
|
Jasons way is correct. In your "simpler" answer you are doing a string comparison which takes longer than testing the length of a string. Its not gonna be noticable difference from the browser side but it is the more efficient way to do it.
-e |
||||||||||||
|
|
|||||||||||||
| CFIF Statement Question |
|
||
|


