Jump to content


Photo

turning one statement to another with else and if


  • Please log in to reply
2 replies to this topic

#1 redarrow

redarrow
  • Members
  • PipPipPip
  • Advanced Member
  • 7,308 posts
  • Locationlondon

Posted 25 May 2006 - 10:05 AM

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.


<?
$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"];
}}
?>

Wish i new all about php DAM i will have to learn
((EMAIL CODE THAT WORKS))
http://simpleforum.ath.cx/mail2.inc
((PAYPAL INTEGRATION THAT WORKS))
http://simpleforum.a...aypal1_info.inc

#2 AndyB

AndyB
  • Staff Alumni
  • Advanced Member
  • 5,465 posts
  • LocationToronto

Posted 25 May 2006 - 10:11 AM

<?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. "'/>";
?>

Legend has it that reading the manual never killed anyone.
My site

#3 redarrow

redarrow
  • Members
  • PipPipPip
  • Advanced Member
  • 7,308 posts
  • Locationlondon

Posted 25 May 2006 - 10:30 AM

[!--quoteo(post=376955:date=May 25 2006, 10:11 AM:name=AndyB)--][div class=\'quotetop\']QUOTE(AndyB @ May 25 2006, 10:11 AM) View Post[/div][div class=\'quotemain\'][!--quotec--]
<?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. "'/>";
?>
[/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) View Post[/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
Wish i new all about php DAM i will have to learn
((EMAIL CODE THAT WORKS))
http://simpleforum.ath.cx/mail2.inc
((PAYPAL INTEGRATION THAT WORKS))
http://simpleforum.a...aypal1_info.inc




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users