drift82
07-12-2005, 05:32 AM
Postgresql does not support the order by 10,5 method of declaring limits and offsets. Hence dir_links.php runs into an error with
$rs = $db->SelectLimit("SELECT L.*, ".$db->IfNull('C.TITLE', "'Top'")." AS CATEGORY FROM {$tables['link']['name']} AS L LEFT OUTER JOIN {$tables['category']['name']} AS C ON L.CATEGORY_ID = C.ID $where ".$orderBy, LINKS_PER_PAGE, LINKS_PER_PAGE * ($page -1));
I fixed it via changing a couple lines
if (defined('SORT_FIELD') && SORT_FIELD != '') {
$orderBy = ' order by '. (SORT_FIELD == 'CATEGORY' ? 'C.TITLE' : 'L.'.SORT_FIELD).' '.SORT_ORDER;
}
$rs = $db->SelectLimit("SELECT L.*, ".$db->IfNull('C.TITLE', "'Top'")." AS CATEGORY FROM {$tables['link']['name']} AS L LEFT OUTER JOIN {$tables['category']['name']} AS C ON L.CATEGORY_ID = C.ID $where ".$orderBy . " limit " . LINKS_PER_PAGE . " offset " . LINKS_PER_PAGE * ($page -1));
If this works with mysql, please update and refrain from the other syntax for us poor postgres users :D
$rs = $db->SelectLimit("SELECT L.*, ".$db->IfNull('C.TITLE', "'Top'")." AS CATEGORY FROM {$tables['link']['name']} AS L LEFT OUTER JOIN {$tables['category']['name']} AS C ON L.CATEGORY_ID = C.ID $where ".$orderBy, LINKS_PER_PAGE, LINKS_PER_PAGE * ($page -1));
I fixed it via changing a couple lines
if (defined('SORT_FIELD') && SORT_FIELD != '') {
$orderBy = ' order by '. (SORT_FIELD == 'CATEGORY' ? 'C.TITLE' : 'L.'.SORT_FIELD).' '.SORT_ORDER;
}
$rs = $db->SelectLimit("SELECT L.*, ".$db->IfNull('C.TITLE', "'Top'")." AS CATEGORY FROM {$tables['link']['name']} AS L LEFT OUTER JOIN {$tables['category']['name']} AS C ON L.CATEGORY_ID = C.ID $where ".$orderBy . " limit " . LINKS_PER_PAGE . " offset " . LINKS_PER_PAGE * ($page -1));
If this works with mysql, please update and refrain from the other syntax for us poor postgres users :D