Page 1 of 1

SQL bug in serendipity_event_entrypaging

Posted: Fri Sep 19, 2008 9:27 pm
by ads
The plugin "serendipity_event_entrypaging" contains a small glitch:

Code: Select all

                $querystring = "SELECT
                                    e.id, e.title, e.timestamp
                                FROM
                                    {$serendipity['dbPrefix']}entries e
                                WHERE
                                    {$cond['compare2']}
                                ORDER BY RAND()
                                LIMIT  1";
The "RAND()" must be "RANDOM()" for databases other than MySQL.

In plugins/serendipity_plugin_recententries/serendipity_plugin_recententries.php is a bugfix available:

Code: Select all

            if ($db ==  'mysql' || $db == 'mysqli') {
                $sql_order = "ORDER BY RAND()";
            } else {
                // SQLite and PostgreSQL support this, hooray.
                $sql_order = "ORDER BY RANDOM()";
            }

Re: SQL bug in serendipity_event_entrypaging

Posted: Sat Sep 20, 2008 1:21 pm
by garvinhicking
Hi!

Thanks a lot, fix committed.

Regards,
Garvin