View Full Version : PHP - Help
Assassinator
19-08-2007, 12:58 PM
Can anyone tell me what is wrong with this?
<?php if($info->rank =='Official Bliss Godfather'){
"<b><font color=red>Official Bliss Godfather</font>";
}
?>
Splinter
19-08-2007, 01:05 PM
Can anyone tell me what is wrong with this?
<?php if($info->rank =='Official Bliss Godfather'){
"<b><font color=red>Official Bliss Godfather</font>";
}
?>
Well firstly could you tell us what errors you get? Also you need to define what $info is. Eg
$info = new class();
Add echo before "<b><font color=red>Official Bliss Godfather</font>"; to output it.
Assassinator
19-08-2007, 01:07 PM
I dont get any errors.Just the rank isnt red.
<font color="red">
Edit:
If you use it in that snipped you'll need it like:
<font color=\"red\">
Assassinator
19-08-2007, 01:10 PM
<font color="red">
Thanks Tom it worked. Rep+
But now my rank is this.
Rank: Official Bliss GodfatherOfficial Bliss Godfather
Post the whole code, not just that snippet.
Assassinator
19-08-2007, 01:12 PM
Post the whole code, not just that snippet.
<div align="right"><font color="grey"><b>Rank:</b></font></div>
</div></td>
<td width="25%"><div align="left">
<?php if($info->rank =='Official Bliss Godfather'){
echo"<b><font color=red>Official Bliss Godfather</font>";
}
?>
<b><font color=white><?=$fetch->rank?></b></div></td>
Why are you adding:
<?php if($info->rank =='Official Bliss Godfather'){
echo"<b><font color=red>Official Bliss Godfather</font>";
}
When
<?=$fetch->rank?>
Gets the rank for you?
If you wanted to make it red then you could just change the html before the $fetch->rank.
Assassinator
19-08-2007, 01:16 PM
Why are you adding:
<?php if($info->rank =='Official Bliss Godfather'){
echo"<b><font color=red>Official Bliss Godfather</font>";
}
When
<?=$fetch->rank?>
Gets the rank for you?
If you wanted to make it red then you could just change the html before the $fetch->rank.
I want all the other ranks white, but "Official Bliss Godfather" Red..
Mentor
19-08-2007, 01:27 PM
your problem is you havent elsed the rest, if your condition is met it does whats between the {} but it doesnt stop whats happening after, the white name from occuring too..
Its easy to fix though thanks to else.
<div align="left">
<?php
if($info->rank =='Official Bliss Godfather'){
echo"<b><font color='red'>Official Bliss Godfather</font>";
}else{
echo "<b><font color='white'>".$fetch->rank."</b>";
}
?>
</div>
Basicly the only change other than some syntax for it to work, is that i put the white name as an else, so if it doesnt do a red name it falls back to the white, but if it does do the red, it doesnt do the white as well.
hope that helps
ps, just wondering is there a reason you have a fetch and an info class which are both holding the exact same information in there rank varible?
Assassinator
19-08-2007, 01:32 PM
your problem is you havent elsed the rest, if your condition is met it does whats between the {} but it doesnt stop whats happening after, the white name from occuring too..
Its easy to fix though thanks to else.
<div align="left">
<?php
if($info->rank =='Official Bliss Godfather'){
echo"<b><font color='red'>Official Bliss Godfather</font>";
}else{
echo "<b><font color='white'>".$fetch->rank."</b>";
}
?>
</div>Basicly the only change other than some syntax for it to work, is that i put the white name as an else, so if it doesnt do a red name it falls back to the white, but if it does do the red, it doesnt do the white as well.
hope that helps
ps, just wondering is there a reason you have a fetch and an info class which are both holding the exact same information in there rank varible?
O hey it worked perfectly.Thanks alot ;) Rep+!
Want to hide these adverts? Register an account for free!
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.