Download & Extend

The block settings have been updated. warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home

Project:Blog Add-ons
Version:6.x-1.1
Component:Miscellaneous
Category:bug report
Priority:normal
Assigned:Chajecki
Status:reviewed & tested by the community

Issue Summary

Hi,

When enabling the block in Drupal 6.2, I am getting the following warning:

'Blog navigation menu' block
Home » Administer » Site building » Blocks
warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/domain/public_html/modules/blog_addons/blog_addons.module on line 321.

Any idea?

Comments

#1

Hi,

thanks for reporting it. This bug shows up in mysql-5.x and I am still using 4.x series so I didn't notice it before. I will prepare new release soon but the immediate solution is to replace lines 320-321

$query = "SELECT n.nid, n.created FROM {node} n WHERE n.type = 'blog' AND n.status = 1 AND n.uid = " . $account->uid . $limit . " ORDER By n.created DESC ";
$postpermonth = mysql_num_rows(db_query($query));

with the following lines
$query = "SELECT COUNT(n.nid) FROM {node} n WHERE n.type = 'blog' AND n.status = 1 AND n.uid = " . $account->uid . $limit . " ORDER By n.created DESC ";
$postpermonth = db_result(db_query($query));

I tested this solution and can confirm it works fine but let me know if you have any problems.

Cheers

#2

Version:6.x-6.x-dev» 6.x-1.x-dev
Assigned to:Anonymous» Chajecki
Status:active» needs review

Patch attached. Please, test it and let me know if you have any problems.
If there is no objections I will commit it in the next release.

Cheers.

AttachmentSize
patch1_6.1.x.patch 1.24 KB

#3

Status:needs review» reviewed & tested by the community

Patch works, fixes the problem.

#4

thx for the patch

#5

How can I implement the patch?

I have the same problem

#6

Thanks for the patch I fixed the problem

and I aplyed the patch following this instructions:

http://drupal.org/patch/apply

#7

I wasnt able to use the patch :(. Is there any other way I could fix this problem/bug?

#8

I couldn't grasp the whole patch thing either :(

#9

Change listed in #1 fixed the problem in 6.x-1.1.

#10

Version:6.x-1.x-dev» 6.x-1.1

I am getting same error in 6.x-1.1.

#11

--> FYI:
The solution provided in #1 for Blog_AddOns ver 6.x.11
works also for the Blog_AddOns ver. 5.x-1.0.

Note:
Tested in LAN environment with MySQL database 5.1.30 Drupal ver. 5.12.
Error evidence come on using the Blog_AddOns-Block inside a BlockBar-Module's Block.

#12

I got this same error with 6.x-1.1 and applied the above fix and the problem went away.

#13

Code from REPLY #1 worked successfully on Drupal 6.10 using latest MySql v 5.x with Blog Add-Ons 6.x-1.1.

Thank you so much. Just confirming for those who need an infinity of confirmations. ;)

#14

Yes the patch worked perfectly thanks!!