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
Mail from PHP form not always ending up in my inbox?
Hi guys,
I'm a real newbie to PHP and have managed to put together a simple mail form that se
Do While statement
hi guys,
This may sound trivial but im new to php and as part of an assignmenti have to const
I need some help with the IF command...
I have a large number of images in one section of my website with the .jpg format. I'm adding a bun
Connection Timeout
I'm using xmii 12.0
I'm calling a transaction as a web service from a windows application
mod_rewrite.c on windows ??
why it's not working on windows while it's working on other hosts???
this is the code i got
Motivational Posters
Hello,
I wonder how can i do them in php. Are there any sample codes that you can show me?
Firefox displaying PHP source code??
Currently testing a site thats almost built, am going to be including php on a sidebar on all pages
Not adding to db
Hi, I can't figure out why it won't add the record to the database. It's just a simple form to get
Running a cron job through PHP/Apache?!
Hello all,
I have a PHP script which makes a cron file from user input. When i try to run the cro
Final year project, please point me in the right direction
hi there for my final year project I'm aiming to build a php script shell to use as an expert system