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
Material Issuing for receiving batch
Dear All experts in MM/ PP,
Material issuing from main stores to factory is currently usi
I apologise! It's a newbie to PHP feedback form problem!
Hi,
I am a total newbie to PHP. I am also a unemployed and need to get a job. So after 100% r
DELETE FROM not working deletes wrong row
Hello
I have the following code which i found but it doesnt work properly.. it comes up with
PRotect my POST DATA... FROM HTML ATTACKS
I need to like let's say
If a user submit's his Prayer and he put's <meta refresh stuf
Regular expression tips or resources
Hello! I'm having some issues implementing the appropriate regex patter to eliminate unwanted charac
IIS & NW MII on the same server
Hi,
We're weighing the possibility to run both IIS and MII (NetWeaver) on the same server
Help with php code
Hello, can anyone tell me why this php word trap fails to work,
and the trigger words get blow r
PHP time (deadline within one week)
I have a column ['projdue'], which stores the deadline for a project.
I have PHP code and <
LOOPing Problem
Hello All!
The following code loops through the data and displays the data accordingly. My p
Multiple Pages
Hi. Im very new to php. I'm trying to create a basic login/registration page.
So I have a bas