Topic: Navigation : Sorting by ( ASC / DESC )
Hi,
I have my custom page where i am using db_pager functionality .. in this i have used asc /desc feature that's 'ord'=>'' , when i click my column name for asc / desc then i get sql error message .. and in that order by "" is blank ... where as same code is working well in my localhost pc..
//=======================
function get_test () {
$sql = "SELECT id,name,datetime FROM ".TB_PREF."test_table ";
return $sql;
}
//=======================
$result = get_test();
$cols = array(
_("ID")=>array('align'=>'center','ord'=>''),
_("Test name ")=>array('align'=>'center','ord'=>''),
_("Added Date")=>array('align'=>'center'),
' '=> array('insert'=>true, 'fun'=>'select_link'),
array('insert'=>true, 'fun'=>'edit_link'),
array('insert'=>true, 'fun'=>'del_link'));
if (!@$_REQUEST['popup']) {
$cols[' '] = 'skip';
}
$table =& new_db_pager('test_table', $result, $cols);
$table->width = "95%";
display_db_pager($table);
//=================================================
when i click on "Test name" column for asc/desc i am getting message
"//-----
DATABASE ERROR : Error browsing database: SELECT id,name,datetime FROM ".TB_PREF."test_table ORDER BY LIMIT 0, 10
error code : 1064
error message : You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'LIMIT 0, 10' at line 1
sql that failed was : SELECT id,name,datetime FROM ".TB_PREF."test_table ORDER BY LIMIT 0, 10
---//"
Hence i got to know that ORDER BY " " is blank .. why so can any one tell me... ? is missing .. i have included all file that's
include($path_to_root . "/includes/db_pager.inc");
include($path_to_root . "/includes/session.inc");
include_once($path_to_root . "/includes/ui.inc");
include_once($path_to_root . "/includes/date_functions.inc");
Note : as i said ...i am able to do "asc/desc" in my local host ...but getting error message in my online server .. pls help me