-2

Currently I need help to dynamically generate an array from MySQL as formatted below.

{
   "data": [
          [
  "Tiger Nixon",
  "System Architect",
  "Edinburgh",
  "5421",
  "2011/04/25",
  "$320,800"
],
[
  "Garrett Winters",
  "Accountant",
  "Tokyo",
  "8422",
  "2011/07/25",
  "$170,750"
],
[
  "Ashton Cox",
  "Junior Technical Author",
  "San Francisco",
  "1562",
  "2009/01/12",
  "$86,000"
],
[
  "Cedric Kelly",
  "Senior Javascript Developer",
  "Edinburgh",
  "6224",
  "2012/03/29",
  "$433,060"
]

}

This script below produces an incomplete array format required for DataTables.

<?php
   include('../mysqli_connect');
  $q = "Select idPersonnel,FName,LName from personnel;
   $result_set = mysqli_query($dbc,$q);
   while($row = mysqli_fetch_array($result_set, MYSQLIASSOC)){
    echo"[".$row['idPersonnel']." ",$row['FName']." ",$row['LName']."]",}."<br>";
   }
   ?>
 
 

Any help would be most appreciated. Thanks!

jchintall
  • 1
  • 1

0 Answers0