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?

CommentFileSizeAuthor
#2 patch1_6.1.x.patch1.24 KBChajecki

Comments

Chajecki’s picture

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

Chajecki’s picture

Version: 6.x-6.x-dev » 6.x-1.x-dev
Assigned: Unassigned » Chajecki
Status: Active » Needs review
StatusFileSize
new1.24 KB

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.

shadyman@erroraccessdenied.com’s picture

Status: Needs review » Reviewed & tested by the community

Patch works, fixes the problem.

Babalu’s picture

thx for the patch

caelico’s picture

How can I implement the patch?

I have the same problem

caelico’s picture

Thanks for the patch I fixed the problem

and I aplyed the patch following this instructions:

http://drupal.org/patch/apply

MagicalViper’s picture

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

HS’s picture

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

khawaja’s picture

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

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

Arshad Vayani’s picture

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

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

David Naian’s picture

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

--> 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.

reikiman’s picture

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

Mr.W.A.C.’s picture

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. ;)

Macronomicus’s picture

Yes the patch worked perfectly thanks!!