Jump to content

Archived

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

redarrow

turning one statement to another with else and if

Recommended Posts

hi there all advance thank you.

i am trying to get the image to appear if the ansaw is no a x.gif or if the ansaw is yes a diffrent image cheers.

[code]

<?
$query4="SELECT * from member_info where name='$name' and id='$id'";
$result4=mysql_query($query4);

while($per4=mysql_fetch_assoc($result4)) {

if($per4["club"]=="yes"){

$per4["club"]="<img src='images/tick.gif'></img>";

}else if($per4["club"]=="no"){

$per4["club"]="<img src='images/x.gif'></img>";


echo $per4["club"];
}}
?>
[/code]

Share this post


Link to post
Share on other sites
[code]<?php
$query4 = "SELECT * from member_info where name='$name' and id='$id'";
$result4 = mysql_query($query4);
$per4 = mysql_fetch_assoc($result4));
if($per4["club"]=="yes"){
    $img = "tick.gif";
} else {
    $img = "x.gif";
}
echo "<img src='images/". $img. "'/>";
?>[/code]

Share this post


Link to post
Share on other sites
[!--quoteo(post=376955:date=May 25 2006, 10:11 AM:name=AndyB)--][div class=\'quotetop\']QUOTE(AndyB @ May 25 2006, 10:11 AM) [snapback]376955[/snapback][/div][div class=\'quotemain\'][!--quotec--]
[code]<?php
$query4 = "SELECT * from member_info where name='$name' and id='$id'";
$result4 = mysql_query($query4);
$per4 = mysql_fetch_assoc($result4));
if($per4["club"]=="yes"){
    $img = "tick.gif";
} else {
    $img = "x.gif";
}
echo "<img src='images/". $img. "'/>";
?>[/code]
[/quote]

fase error were cheers.

[!--quoteo(post=376960:date=May 25 2006, 10:23 AM:name=redarrow)--][div class=\'quotetop\']QUOTE(redarrow @ May 25 2006, 10:23 AM) [snapback]376960[/snapback][/div][div class=\'quotemain\'][!--quotec--]
fase error were cheers.
[/quote]

[!--sizeo:5--][span style=\"font-size:18pt;line-height:100%\"][!--/sizeo--]solved[!--sizec--][/span][!--/sizec--] cheers

Share this post


Link to post
Share on other sites

×

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.