PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
<?
if($affstatus == "Pending"){
$protext="Your application to run this campaign is under review, please allow 48hrs to review your application.";
} elseif($affstatus == "Declined"){
$protext="Your application to run this campaign has been Declined. Please speak with your affiliate manager.";
} elseif($affstatus == "Approved"){
//display banners etc..
$display=eval('echo "'.$string.'";');
$protext="<table width='741' border='0' cellpadding='2' cellspacing='2'>
<tr>
<td bgcolor='#FFFFFF'><strong>Banner ID:</strong> <? echo $bannerid; ?><br />
<img src='<? echo $bannerurl; ?>' /></td>
</tr>
<tr>
<td bgcolor='#FFFFFF'><textarea name='BannerCode' id='BannerCode' cols='60' rows='5'><? echo $display; ?></textarea></td>
</tr>
</table>";
}
echo $protext;
?>
The output is fine if $affstatus is Pending. If value is Approved then nothing is displayed and if the value is Declined then it outputs the text but it outputs it 3 times for some reason.
That code needs to be in there as the value of one of the rows in the database has PHP variable tags in it which need to be replaced. It works with this code below.
<?
//GET BANNERS FOR PROGRAM
mysql_connect(localhost,$username,$password);
@mysql_select_db($database) or die( "Oops theres an error, our highly trained monkeys have been notified.");
$query="SELECT * FROM programbanners WHERE ProgramID ='$programid'";
$result=mysql_query($query);
$num=mysql_numrows($result) or die(mysql_error());
$i=0;
while ($i < $num) {
$bannerid=mysql_result($result,$i,"BannerID");
$type=mysql_result($result,$i,"Type");
$code=mysql_result($result,$i,"Code");
$bannerurl=mysql_result($result,$i,"BannerURL");
$string = $code;
$string = addslashes($string);
?>
Also the code you told me try doesnt look any different except the line you asked about being removed.
Hmmm, I'll looked at it in my own php editor and it looks correct for the most part (outside of stylizing for coding ;p), so I have no idea why it would be displaying three times if it's anything other than pending. Can you try changing it, so it's IF(){} and for the elseif make them if(){} and see where the code is going weird. Also I would check to see what the actual value is for the $affstatus variable to make sure it's not being changed at some point (who knows). But the only think I can think of why it would be displaying it 3times is, a loop or the value for the conditional is not proper for some reason.
Thanks for getting back to me, yea i always echo the value of a variable im having a problem with and everything is fine which is why i dont understand why its not working right. Do you mind if i provide you with the php file you can take a look at it for me please?
Also pm me an email address in order to send you the file if your willing to take a look for me.