Looking for some help from the experts:
Here is the code:
function getCouponRecord($recordID) {
global $default_dbname, $default_tablename;
echo ("getCouponRecord:recordID = $recordID<BR>");
$link_id = db_connect();
mysql_select_db($default_dbname);
$query = "SELECT * FROM $default_tablename WHERE coupid = '$recordID'";
echo ("getCouponRecord:query = $query<BR>");
$result = mysql_query($query) || error_message(sql_error());
if (!$result) {
echo "Could not successfully run query ($query) from DB: " . mysql_error();
exit;
}
echo ("getCouponRecord:result = $result<BR>");
$currentCoupon = mysql_fetch_assoc($result);
echo ("getCouponRecord:currentCoupon.coupid = $currentCoupon['coupid']<BR>");
echo ("getCouponRecord:currentCoupon.couptext = $currentCoupon['couptext']<BR>");
echo ("getCouponRecord:currentCoupon.coupprinted = $currentCoupon['coupprinted']<BR>");
mysql_close($link_id);
}
And here is my output:
getCouponRecord:recordID = 1
getCouponRecord:query = SELECT * FROM coupon WHERE coupid = '1'
getCouponRecord:result = 1
Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in c:\inetpub\wwwroot\coupons\coup_common.inc.php on line 124
getCouponRecord:currentCoupon.coupid =
getCouponRecord:currentCoupon.couptext =
getCouponRecord:currentCoupon.coupprinted =
Is it telling me that $result is not a valid resource? The query isn't failing as far as I can tell...that's why I printed out the value of $result. I can run this query directly against my database.
What gives...I'm pulling my hair out on this one and I'm sure it's something stupid on my part.
TIA!