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 assigning value to variable in "IF" function
Does this script makes sense? I am trying to take the value that is set to "authenticat" a
Display certain image depending on time of year
Hi, I am new to these forums and would really appreciate some advice on a piece of coding I have don
How to replace search button with link?
hi to everbody.
i have a search submit form and button like this :
<form id="f
file_put_contents and createimagefromjpeg
All,
I do somethings and then I have the following code:
file_put_contents('./test/'.$filename
Coding Critique
I was hoping someone could take a second and look down my code and see if they see any problems with
use an array from 1 class in a second class
I have a class that adds data to an array
Then I have a second class and I need to check if t
please fix the error
What is the error in the below code ???
Line number On/Off | Expand/Contract <?php
Send current URL in URL with a $_GET variable problem.
Hello community,
I have created a function that gets the current variable of a page, example:
CHECK A STRING FOR ' " ' (DOUBLE QUOTES)
I am checking for delimiter (.!?) and if there is a " after a sentence then it should neglect a
Confusing Functions
So, I've been reading up on Functions and I like them! However, I need some help using variables in