Topic: admin_ranks.php error in query syntax

As I am using SQLite I may be just one of few where this bug becomes apparent. On trying to update a rank I found that an error was generated - yet it worked fine with MySQL. After a little hunting and testing I found this:

// Make sure there isn't already a rank with the same min_posts value
    $result = $db->query('SELECT 1 FROM '.$db->prefix.'ranks WHERE id!='.$id.' && min_posts='.$min_posts) or error('Unable to fetch rank info', __FILE__, __LINE__, $db->error());

It appears that SQLite doesn't like the shorthand && and you have to use AND, so the affected part becomes

// Make sure there isn't already a rank with the same min_posts value
    $result = $db->query('SELECT * FROM '.$db->prefix.'ranks WHERE id!='.$id.' AND min_posts='.$min_posts) or error('Unable to fetch rank info', __FILE__, __LINE__, $db->error());

providing I didn't mistype my search, a quick check on the other scripts doesn't reveal any more instances of utilising  &&

my mind is on a permanent tangent
byUsers forum

Re: admin_ranks.php error in query syntax

Thanks for the report. We have however already dealt with this in PunBB 1.3.

http://dev.punbb.org/changeset/638

"Programming is like sex: one mistake and you have to support it for the rest of your life."

Re: admin_ranks.php error in query syntax

bah smile

Good to hear its fixed for the next version.

my mind is on a permanent tangent
byUsers forum

Re: admin_ranks.php error in query syntax

And now the fix has been backported big_smile

http://dev.punbb.org/changeset/858

http://fluxbb.org

Free PunBB Hosting - lots of mods, easy to customize