// CHECK STATUS OF APPLICATION
mysql_connect(localhost,$username,$password);
@mysql_select_db($database) or die( "Oops theres an error, our highly trained monkeys have been notified.");
$queryaff = "SELECT Status FROM `affprograms` WHERE `AffID` = '$affid' AND `ProID` = '$programid'";
mysql_query($queryaff);
$resultaff = mysql_query($queryaff);
mysql_close();
if($resultaff="Pending"){
$affstatus="Pending";
} elseif($resultaff="Approved"){
$affstatus="Approved";
} elseif($resultaff="Declined"){
$affstatus="Declined";
} else {
//do nothing
}
echo "$queryaff <br /> $resultaff <br />";
echo "TEST OUTPUT - $affstatus";
// END CHECK STATUS OF APPLICATION
Here is the output:
SELECT Status FROM affprograms WHERE AffID = ‘1’ AND ProID = ‘2’
Pending
TEST OUTPUT - Pending
Now the problem is the result is not correct, it shouldnt be returning the value Pending and instead it should be returning the value Approved. Now when i run the MySQL Query in PHPMYADMIN i get the correct result:
So why when i run my script is it returning the incorrect value when im using the same SQL as i have in phpmyadmin?
Thanks for your help, i have done what you suggest and here is the code i am now using:
// CHECK STATUS OF APPLICATION
mysql_connect('localhost',$username,$password);
@mysql_select_db($database) or die( "Oops theres an error, our highly trained monkeys have been notified.");
$queryaff = "SELECT Status FROM `affprograms` WHERE `AffID` = '$affid' AND `ProID` = '$programid'";
mysql_query($queryaff);
$resultaff = mysql_query($queryaff);
$affstatus = $resultaff;
mysql_close();
echo "$queryaff <br />";
echo "TEST OUTPUT - $affstatus";
// END CHECK STATUS OF APPLICATION
Thank you aaMonkey you have been a big help and resolved this problem. I’d also like to thank everyone else who have offered help in resolving the problem i had. Thank you.
Now i have another problem
<?
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.