Counter for comments shows wrong number

Found a bug? Tell us!!
Post Reply
User avatar
SoWhy
Regular
Posts: 23
Joined: Wed Mar 29, 2006 3:28 pm
Location: Munich (Germany)
Contact:

Counter for comments shows wrong number

Post by SoWhy » Sat Dec 16, 2006 3:28 pm

Hi there,

don't know how to phrase this, so I just try it:
On the post-view the number shown in "Comments (X)" is not correct. Is there a way to update that number to recount the comments?
For example: this one shows 0 while there is one and this one shows 4 while there are seven.

I hope I was able to say what bothers me.

TIA

SoWhy

User avatar
judebert
Regular
Posts: 2478
Joined: Sat Oct 15, 2005 6:57 am
Location: Orlando, FL
Contact:

Post by judebert » Sun Dec 17, 2006 4:08 am

We've been having some trouble with comment counts. The weirdest one is when it goes negative, which results in a really big number.

Garvin knows what's going on, but he's traveling right now. You can either wait until he gets back, or try a forum search.
Judebert
---
Website | Wishlist | PayPal

User avatar
garvinhicking
Core Developer
Posts: 30020
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post by garvinhicking » Sat Dec 23, 2006 12:08 pm

Hi!

The counting bug should be fixed in the recent 1.0.4 release; you can use this SQL to fix the comment count:

Code: Select all

UPDATE serendipity_entries AS e SET e.comments = (SELECT count(c.entry_id) FROM serendipity_comments AS c WHERE c.entry_id = e.id AND c.status = 'approved') 


HTH,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/

User avatar
SoWhy
Regular
Posts: 23
Joined: Wed Mar 29, 2006 3:28 pm
Location: Munich (Germany)
Contact:

Post by SoWhy » Sat Dec 23, 2006 2:10 pm

Tried that, my phpMyAdmin replies with:

Code: Select all

Error

SQL query:

UPDATE s9y_entries AS e SET e.comments = ( SELECT count( c.entry_id )
FROM s9y_comments AS c
WHERE c.entry_id = e.id
AND c.status = 'approved' )

MySQL said:
#1064 - You have an error in your SQL syntax near 'AS e SET e.comments = (SELECT count(c.entry_id) FROM s9y_comments AS c WHERE c.e' at line 1

Most likely my old MySQL version (3.23.58) does not understand it (can't see why tho), I updated it manually where I saw it wrong. Thanks anyways

User avatar
garvinhicking
Core Developer
Posts: 30020
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post by garvinhicking » Sun Dec 24, 2006 12:38 pm

Hi!

Ah, yes. MySQL 3.x does not allow Sub-Queries. :)

Best regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/

Post Reply