0) { $where = join(" AND ", $where); $sql = $selectorCount." FROM ".$fromTable." WHERE ".$where; $sqlTotalDisplayRows = $sql; $sql = $selectorRows." FROM ".$fromTable." WHERE ".$where." ORDER BY ".$orderby; //limit the results returned. if ($displayLength !== -1) { $sql .= " OFFSET ".$data["iDisplayStart"]." LIMIT ".$displayLength; } } else { $sql = $selectorRows." FROM ".$fromTable." ORDER BY ".$orderby; //limit the results returned. if ($displayLength !== -1) { $sql .= " OFFSET ".$data["iDisplayStart"]." LIMIT ".$displayLength; } } try { $r = $con->query($sqlTotalRows); $totalRows = $r->fetchColumn(0); if (isset($sqlTotalDisplayRows)) { $r = $con->query($sqlTotalDisplayRows); $totalDisplayRows = $r->fetchColumn(0); } else { $totalDisplayRows = $totalRows; } $r = $con->query($sql); $r->setFetchMode(PDO::FETCH_ASSOC); $results = $r->fetchAll(); } catch (Exception $e) { Logging::debug($e->getMessage()); } return array( "sEcho" => intval($data["sEcho"]), "iTotalDisplayRecords" => intval($totalDisplayRows), "iTotalRecords" => intval($totalRows), $dataProp => $results ); } }