Create jQuery DataTable With PHP MySqli Query Results As Source

Hi - I have done this with MS SQL and Joomla but am trying to use Wordpress and MySql. This is a link to the Query tool I am wanting to use – and this is my code I’m starting with…

I know I’m in the beginning phases but am not sure how to get the array from my PHP code to the JQuery that the datatable needs?

$dblink = mysqli_connect("website", "user", "pass", "database");
if (mysqli_connect_errno()) {
    echo "Could  not connect to database: Error: ".mysqli_connect_error();
$sqlquery = "SELECT employee FROM employees LIMIT 10";
if ($result = mysqli_query($dblink, $sqlquery)) {
    while ($row = mysqli_fetch_assoc($result)) {
     $types[] = $row['employee'];


echo json_encode($types)

Sponsor our Newsletter | Privacy Policy | Terms of Service