BUG: cmsb 3.59: order by

4 posts by 3 authors in: Forums > CMS Builder
Last Post: July 5, 2023   (RSS)

By kitsguru - June 4, 2023

I am testing cmsb 3.59 under php 8.1 with MariaDB v10.11.2 and getting the following error. This is happening whenever I have a left join.

Notice: MySQL Error: Column 'dragSortOrder' in order clause is ambiguous - in viewer_functions.php on line 343 by mysql_get_query in /Volumes/J/@projects/yaaws5/html/www/cmsb/lib/common.php on line 304

Here a sample getRecords call:

list($theRecords, $theMetaData) = getRecords(array(
    'tableName'   => 'bios',
    'where'       => $pageWhere,
    'loadUploads' => true,
    'allowSearch' => true,
    'leftJoin'    => array(
        'companies' => 'company'),
    'limit'       => '1',
    'debugSql'    => false,

It appears to picking up the orderBy clause from the editor sorting field, both tables have the dragSortOrder specified. 


Add a specific orderBy clause to the getRecords call with a fully qualified name 'orderBy' => "bios.dragSortOrder'.


This does happen with cmsb 3.57 and php 8.0

Jeff Shields

By Dave - June 4, 2023

Hi Jeff, 

Thanks for posting this, we'll check it out.  

Can you temporarily set debugSql => true, and post the query that is being generated (or the relevant parts of it). 


Dave Edis - Senior Developer

By mark99 - July 5, 2023

I get something similar after going from 3.57 to 3.59, also focused on line 304 of common.php:

E_USER_NOTICE: MySQL Error: Unknown column 'totalReviewsCount' in 'order clause' - in viewer_functions.php on line 543 by mysql_get_query()

Url: https://www....co.uk/../../?orderBy=totalReviewsCount&num=17

File Path: /../system/lib/common.php