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
Problem executing bash script using shell_exec
Hi there,
I created a bash script file using following code to convert doc documents to pdf using
Strange Oracle Query problem
Ok So I have this PHP class that talks to a Javascript class that basically creates a table of infor
Business Health Check
Hello
I need to create an online business health check for a client it will be multiple choi
restricting another login once you logout
Hello,
how can I restrict a page from login authenticating against info in a MySQL DB for a s
$variable = $variable
Hello
Sorry if this is a really simple question but I have run out of ideas. Is there a reall
Page doesn't expand for content
Hi. I've been testing a query I made. It's here http://lapr1.6te.net/inquerito.php
The page doesn
How to set pass login name from htaccess to php
When the user logs into my members page via htaccess, I'd like to retain the username so that I can
PHP Directory Listing Not working
Hey Guys,
I need help, I tried a ton of directory listing scripts and they all don't work. Al
Executing an exe
Hi. I have some bizarre problem with exec (other any other method) to launch exe's. I am making a ga
Passing Arguments to execlp()
I'm writing a program that mimics a unix shell. It's supposed to take commands with arguments and ex