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!
Here's your code, put within PHP tags. Take a look at the sticky at the top of the forum for more guidlines (Highlighting makes it infinitely easier to look at code).
<?
$dbHost = "subdomain.server.com";
$dbName = "database_name";
$dbUser = "database_user";
$dbPass = "database_password";
$connmts = mysql_connect($dbHost, $dbUser, $dbPass) or trigger_error(mysql_error(),E_USER_ERROR);
$link = @mysql_connect($dbHost, $dbUser, $dbPass);
if (!$link){
$errorMsg = "Could not connect to server";
print "&result=Fail&errorMsg=$errorMsg";
exit;
}
if (!@mysql_select_db($dbName)){
$errorMsg = "Could not select $dbName database";
print "&result=Fail&errorMsg=$errorMsg";
exit;
}
$hold = $_REQUEST['merchant'];
$query = "SELECT * FROM coupons WHERE id LIKE '$hold%' AND active = 1 ORDER BY id asc";
$merchants = mysql_query($query, $connmts) or die(mysql_error());
if (mysql_num_rows($merchants) < 1) {
print "There are no offers at this time. ";
} else {
while ($row = mysql_fetch_array($merchants, MYSQL_ASSOC)) {
$list = $row['info'];
$coupon = $row['coupon'];
$merchant_name = $row['merchant_name'];
print "<strong>$merchant_name</strong><br><br>";
print "<a href='http://www.address.com/proxy.asp?action=clip&coupon=$coupon'>";
if ($list != 0) {
print "<strong>$list</strong>";
} else {
print "<br>";
}
print "<br>";
}
}
?>
I'm thinking your problem is that nothing is being echoed at all? If that's the case, it's due to the fact that you're comparing $list, a string, with 0, a number. Put 0 in quotes and it'll probably work:
u can chek the value using after convertin it to integer using the funtion eval() or u can check as its a string ,like '0' ( depend on ur database vaue)