Jump to content

turning one statement to another with else and if


redarrow

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]
Link to comment
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]
Link to comment
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
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.