Warning: mysql_num_rows() supplied argument is not a valid MySQL result resource
Posted on
16th Feb 2014 07:03 pm by
admin
This may be simple I just may need another pair of eyes..
When i get records back the below code works just fine, when I get 0 rows back it shows the warning below. As you can see I tried to code for it and you can see that the code works as it echo's my message but I want the warning to go away
Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in show_coupon_list.php on line 224
No Coupons for this Catogory or Business. Please let us know about the Category that displayed no results so we can contact businesses for you!
Code: $cat_coupons = mysql_query("SELECT a.business_name, a.seq_id, a.state, a.city
FROM users a where a.seq_id = '$cat_coupons_seq_id'");
Code: $cat_num=mysql_num_rows($cat_coupons);
if ($cat_num > 0)
{
while ($row = mysql_fetch_array($cat_coupons))
{
$business_name = $row["business_name"];
$business_id = $row["seq_id"];
$state = $row["state"];
$city = $row["city"];
echo"<tr>
<td align = 'left'> <a href=show_coupon.php?business=".urlencode($business_name).">$business_name $city,$state </a></td>
</tr>";
}
}
else
echo"<tr>
<td>No Coupons for this Catogory or Business. Please let us know about the Category that
displayed no results so we can contact businesses for you!
</td>
</tr>";
No comments posted yet
Your Answer:
Login to answer
348
5
Other forums
Securing a user input - need some confirmation
Hello All,
I am in the process of recoding a large proportion of an e-commerce site, one of t
Get ID from Database when Posting with a HTML Form
I have a form I am submitting to a MySql database. Each product has an ID # attached to it that auto
Solution to the FindControl problem
I have seen may posts about having problems with the FindControl method. Most seem to come about bec
SQL query not working well
Hi,
I made a small table with 5 rows and want to make them an sql consult using rownum
Using system() and bringing back the results
I am aware that you can use system() within PHP to execute system commands, but I was wondering if t
Passing an array of values From VB6.0 to Oracle PL/SQL Function
Basically we are using VB6.0.
When we try to pass an array from VB6.0 to an Oracle PL/SQL
! = ''
In the following 'IF' statement if v_ompcat = PU for example then Oracle equates that 'IF' statement
There was a problem with the request. (Code: 0)
Any Idea what could cause this? I get it randomly at best. But with both IE and FF. It derives from
need to apply an if/else statement to Tim Thumb script
Not sure how to work this. I essentially want to call a variety of image sizes based on which style
Php script to read msword file
hi,
I need to read a msword file and i want to print the contents in that word file.
i