
HAVING hadithmain.BookID = ? ORDER BY hadithmain.HadithNo ASC");
$mainHadith->bindParam("il", "".(isset($_GET['hadith'])?$_GET['hadith']:"") ."", "-1"); //WAQB_Param1
adding the "l" to the parameter tell it that you are passing an "integer list" and not a single integer.

After changing and passing value to url like index.php?hadith=1,2 it shows
There is an error in your SQL syntax.