[eluser]kodai[/eluser]
I used this code before in SVN 1.62 and run well but in 1.72 run with error
Code: $this->db->select('tbl_menu.ID_MENU, concat(repeat(" ",length(MENU_PATH)/4),tbl_menu.MENU_NAME) as MENU_NAME2,ID_MENU_PARENT,MENU_PATH,SEQUENCE_NUMBER,MENU_URL,MENU_TYPE,STATUS_ACTIVE,MENU_NAME');
$this->db->from("tbl_menu");
$this->db->orderby('concat(MENU_PATH,if(ID_MENU>999,"",if(ID_MENU>99,"0",if(ID_MENU>9,"00","000"))),ID_MENU)');
$this->db->orderby('ID_MENU_PARENT','ASC');
$this->db->orderby('MENU_PATH','ASC');
Quote:A Database Error Occurred
Error Number: 1064
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 'FROM (`tbl_menu`) ORDER BY concat(MENU_PATH, if(ID_MENU>999, `""`, if(ID_MENU>99' at line 2
SELECT `tbl_menu`.`ID_MENU`, concat(repeat(" ", length(MENU_PATH)/4), `tbl_menu`.`MENU_NAME)` as MENU_NAME2, `ID_MENU_PARENT`, `MENU_PATH`, `SEQUENCE_NUMBER`, `MENU_URL`, `MENU_TYPE`, `STATUS_ACTIVE`, `MENU_NAME` FROM (`tbl_menu`) ORDER BY concat(MENU_PATH, if(ID_MENU>999, `""`, if(ID_MENU>99, `"0"`, if(ID_MENU>9, `"00"`, `"000")))`, `ID_MENU)`, `ID_MENU_PARENT` ASC, `MENU_PATH` ASC
Probably someone can help to investigate it? Thanks
|