ah... ok, i understand now... change: $query = "SELECT * FROM addetail order by " . $_GET['column_id']; Code (markup): to: if($_GET['column_id'] != "") { $query = "SELECT * FROM addetail order by " . $_GET['column_id']; } else { $query = "SELECT * FROM addetail"; } Code (markup): that should do it.
hey thankz again..the errors have gone now... but now the sorting is not workin... i mean the links are there but nothin happens when i click it...;(
sorry... my mistake - i'm really getting old... it should be: if([B][COLOR="Red"]$_GET['sort'][/COLOR][/B] != "") { $query = "SELECT * FROM addetail order by " . [B][COLOR="Red"]$_GET['sort'][/COLOR][/B]; } else { $query = "SELECT * FROM addetail"; } Code (markup):
good to know and if you want the default page to sort by a certain field, you can try this: if($_GET['sort'] != "") { $query = "SELECT * FROM addetail order by " . $_GET['sort']; } else { $query = "SELECT * FROM addetail order by [B][COLOR="Red"]default_column[/COLOR][/B]"; } Code (markup): replace default_column with the column you want to sort by default...