functions_entries.inc.php
$entries =& serendipity_db_query("SELECT count(id) ...
$entry_count will be 1 in all cases.
fix:
$entries =& serendipity_db_query("SELECT count(id) AS cnt ...
if (is_array($entries)) {
// this returns 1 in all cases! $entry_count = count($entries);
$entry_count = $entries['cnt'];
} else {
$entry_count = 0;
}
bug in counting entries
bug in counting entries
Keep It Simple ...
-
garvinhicking
- Core Developer
- Posts: 30022
- Joined: Tue Sep 16, 2003 9:45 pm
- Location: Cologne, Germany
- Contact:
Re: bug in counting entries
Hi!
It fetches the numerical index, so it should work (and at least it does in all installations I have acccess to).
Which database type and version are you using?
Best regards,
Garvin
It fetches the numerical index, so it should work (and at least it does in all installations I have acccess to).
Which database type and version are you using?
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/
# 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/
Re: Re: bug in counting entries
Hi Garvin,
I use MySQL 5.0.27 with php 5.2.
without the fix i get 1 for the count of entries for every month in the list of 'older entries' (Archives).
File:
$Id: functions_entries.inc.php 1520 2006-11-30 21:34:29Z garvinhicking $
I found the problem in row 1471:
function serendipity_printArchives() {
...
$entries =& serendipity_db_query("SELECT count(id) ...
$entry_count = count($entries);
...
}
Best Regards
I use MySQL 5.0.27 with php 5.2.
without the fix i get 1 for the count of entries for every month in the list of 'older entries' (Archives).
File:
$Id: functions_entries.inc.php 1520 2006-11-30 21:34:29Z garvinhicking $
I found the problem in row 1471:
function serendipity_printArchives() {
...
$entries =& serendipity_db_query("SELECT count(id) ...
$entry_count = count($entries);
...
}
Best Regards
Keep It Simple ...
-
garvinhicking
- Core Developer
- Posts: 30022
- Joined: Tue Sep 16, 2003 9:45 pm
- Location: Cologne, Germany
- Contact:
Re: Re: bug in counting entries
Hi!
Seems like you used an older version. I just saw the fix you mention is already contained in recent s9y versions; which one are you using?
Best regards,
Garvin
Seems like you used an older version. I just saw the fix you mention is already contained in recent s9y versions; which one are you using?
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/
# 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/