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
Did you know?Explore Trending and Topic pages for more stories like this.
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
PO Release Strategy Issue
Hi Experts,
I am facing an issue related to PO release strategy. The details are-
<
php file erros / need help please
Hello
Someone decoded a zend file for me.. after uploaded it on ftp i get some errors, i trye
Session problem?!?
Hello All! I am very new to the php world but I am working on fixing things that a previous programm
reating a background image
I am building a site in drupal and have a php form in it, due to certain annoyances with module buil
Please help with code for SMTP authenticated PHP email form
Hello, I'm creating a PHP email form, and for this particular server, I have to use SMTP Authenticat
PHP hyperlinks generator - HELP plz
Hi
I need some help to get this done using php:
1 - I have few hyperlinks say 500
help me, how to find text on an external html site using PHP
Would anyone know how to search an external html file for a work or phrase ?
I was thinking s
session variables not working anymore
hello,
i use sessions to handle authentication within my site. my host has been changing a lot of
How to get all server headers like Live http Headers does
Hey all, like many of you I use the Firefox addon "Live http Headers". I'm trying to write
opening a window with after form submission
I know this this forum has nothing to do with JS, but i'm trying to use it with my php script.
<