Pagination with large json results using PHP and AngularJS -


so have parse large set of data that's been formatted json, stored in database.

require_once('db.php'); error_reporting(1); $getusers = mysqli_query($db, 'select * mcmmo_users limit 300'); $rows = array();  while ($r = mysqli_fetch_assoc($getusers)) {     $skills = array();     $temprow = $r;     $getskills = mysqli_query($db, "select * mcmmo_skills user_id = '" . $r['id'] . "' limit 300");     while ($r = mysqli_fetch_assoc($getskills))     {         unset($r['id']);          $skills[] = $r;     }     $temprow['skills'] = $skills;     $rows[] = $temprow; }  header('content-type: application/json'); echo json_encode($rows); 

which outputs:

[{"id":"1","user":"user1","lastlogin":"1402936307","skills":[{"user_id":"1","taming":"4","mining":"534","woodcutting":"84","repair":"26","unarmed":"0","herbalism":"108","excavation":"219","archery":"10","swords":"75","axes":"24","acrobatics":"74","fishing":"403","alchemy":"0"}]} 

but on 15,000 records of it.

i'd create single page application using angularjs. have far:

require_once('db.php'); error_reporting(1); $getusers = mysqli_query($db, 'select * mcmmo_users limit 300'); $rows = array();  while ($r = mysqli_fetch_assoc($getusers)) {     $skills = array();     $temprow = $r;     $getskills = mysqli_query($db, "select * mcmmo_skills user_id = '" . $r['id'] . "' limit 300");     while ($r = mysqli_fetch_assoc($getskills))     {         unset($r['id']);          $skills[] = $r;     }     $temprow['skills'] = $skills;     $rows[] = $temprow; }  header('content-type: application/json'); echo json_encode($rows); 

index.html:

    <table class="table table-striped" ng-controller="mcmmoctrl">         <tr>             <th>player</th>             <th>taming</th>         </tr>         <tr ng-repeat="stats in mcmmo">             <td>{{ stats.user }}</td>             <td>{{ stats.skills[0].taming }}</td>         </tr>     </table> 

unless limit data, takes on 5 minutes see in view. i'm hoping if there simple way "page" can click on "more" button, or page 1, 2 without having change pages.

how can this?


Comments

Popular posts from this blog

python - mat is not a numerical tuple : openCV error -

c# - MSAA finds controls UI Automation doesn't -

wordpress - .htaccess: RewriteRule: bad flag delimiters -