Jump to content

If there or not there


SkyRanger

Recommended Posts

[!--quoteo(post=385510:date=Jun 18 2006, 11:44 PM:name=SkyRanger)--][div class=\'quotetop\']QUOTE(SkyRanger @ Jun 18 2006, 11:44 PM) [snapback]385510[/snapback][/div][div class=\'quotemain\'][!--quotec--]
Here is the situation:

I use to have a piece of code from along time ago that did this for me, but I lost it, can can't remember how I did it.
This is what I need:

mysql garbage

if $image exists echo '$image'
if $image does not exist then echo "No Image"

Can anybody help me with this?
[/quote]


Nevermind, found what I was looking for:

[code=php:0]
echo "<img src=image/" . ($row['image'] == 'Yes' ? "$image" : "No Image") . "' />";
[/code]
Link to comment
https://forums.phpfreaks.com/topic/12349-if-there-or-not-there/#findComment-47193
Share on other sites

[!--quoteo(post=385515:date=Jun 18 2006, 11:56 PM:name=SkyRanger)--][div class=\'quotetop\']QUOTE(SkyRanger @ Jun 18 2006, 11:56 PM) [snapback]385515[/snapback][/div][div class=\'quotemain\'][!--quotec--]
Nevermind, found what I was looking for:

[code=php:0]
echo "<img src=image/" . ($row['image'] == 'Yes' ? "$image" : "No Image") . "' />";
[/code]
[/quote]

Ok, thought I had it but I am getting this error:
Parse error: parse error, unexpected T_CONSTANT_ENCAPSED_STRING in /home/low/public_html/roster.phtml on line 167

This is the code I have:


[code]
<? echo "<img src='" . ($row['image'] == 'Yes' ? $image"/>View Image</a>" : "No Image") . "'"; ?>
[/code]
Link to comment
https://forums.phpfreaks.com/topic/12349-if-there-or-not-there/#findComment-47199
Share on other sites

[!--quoteo(post=385526:date=Jun 19 2006, 12:36 AM:name=Crayon Violent)--][div class=\'quotetop\']QUOTE(Crayon Violent @ Jun 19 2006, 12:36 AM) [snapback]385526[/snapback][/div][div class=\'quotemain\'][!--quotec--]
umm..

[code]
if ($row['image']) {
   echo "<img src = '" . $row['image'] . "' />";
} else {
  echo "no image";
}
[/code]
[/quote]

Awsome, thanks, exactly what I needed
Link to comment
https://forums.phpfreaks.com/topic/12349-if-there-or-not-there/#findComment-47330
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.