Server-side Pagination with involving multiple tables

Server-side Pagination with involving multiple tables

syedmdanialsyedmdanial Posts: 4Questions: 2Answers: 0

Hi guys, I'm rather new in the programming world. Trying yo figure out how to use the server-side pagination. I've used DataTables before but only the normal, client-side pagination way. When I tried making it into a server-side, I don't know how to make it work.

function getAllProjects($pageNumber = 1){

      $limit = 10;
      $skip = ($pageNumber - 1) * $limit;
      $allProjects = json_decode(json_encode($this->db->query("SELECT project_info.project_name,
      project_info.project_id,
      project_info.screenshot,
      project_info.user_id,
      project_info.project_index_page,
      project_info.last_updated_timestamp,
      project_info.analytics_id
      FROM project_info
      WHERE project_info.is_deleted = 0")->result()), true);
      //LIMIT $limit OFFSET $skip")->result()), true); // select those that is not yet deleted  
      if($allProjects){
           return $allProjects; //return all projects that is available & not yet deleted
      }
      else{
           return false;
      }
 }

Answers

This discussion has been closed.