Resouce not boolean

;D
Hello all
Thanks for the past information.

This is a new error that has cropped up. no changes made to the original program. Just started to happen.

Warning: mysql_num_rows() expects parameter 1 to be resource, boolean given in /home/dmens/public_html/shoppel/system/includes/process_transaction.php on line 604

the code is as follows :

[php] $queryString = “SELECT c.coupon_expirydate,coupons_cities.cityname, coupons_country.countryname,cs.shopid, cs.shopname, cs.shop_address,cs.shop_url, cu.firstname,cu.lastname,cu.email, c.coupon_name, c.coupon_fineprints, c.coupon_phoneno, c.coupon_image, c.deal_url, cp.coupon_validityid FROM coupons_purchase cp left join coupons_users cu on cp.coupon_userid = cu.userid left join coupons_coupons c on c.coupon_id=cp.couponid left join coupons_shops cs on cs.shopid = c.coupon_shop left join coupons_country on coupons_country.countryid=cs.shop_country left join coupons_cities on coupons_cities.cityid=cs.shop_city left join transaction_details td on td.ID=cp.transaction_details_id
where cp.couponid=’$cid’ and cp.gift_recipient_id=0 and td.CAPTURED=‘1’”;
}
$resultSet = mysql_query($queryString);

	if(mysql_num_rows($resultSet)>0)					// LINE 604
	{
        while($row=mysql_fetch_array($resultSet))
	{

[/php]

Thanks in advance

$resultSet is a boolean instead of a number. I’m not too familiar with these little details of PHP, but I would guess that this means $resultSet didn’t return any values or failed to return values, or is null or something weird like that.

My recommendation: Post more of your code. It seems you have an ending curly brace floating around in the code snippet you posted, and I wonder if that is part of a conditional code block that isn’t executing, causing your query string to never be set, causing $resultSet to fail and become “false”. If you know what I’m talking about, check your code. If not, post more.

Your query is failing and not returning a results set. So the value of $resultSet is ‘false’, which you are passing to mysql_num_rows()… then you see the error you posted.

Use mysql_error() to see what’s wrong with the query:

[php]
$resultSet = mysql_query($queryString) or die(mysql_error());
[/php]

HI all

Thanks for the help. I was looking in the wrong area I guess. Not having written this and my inexperience had me baffled.

The error was not where I expected it to be.

Quite strange actually, as this program has been running for 4 months without any maintenance and it just suddenly stopped working. The error was in the SELECT with a column not being in the mysql

It is now working quite OK after taking the offending field name out. Very Odd indeed.

Noel :o

Sponsor our Newsletter | Privacy Policy | Terms of Service