Search code examples
dhtmlxdhtmlx-scheduler

Dhtmlx connection loading data


I have started using the Dhtmlx Scheduler a few days ago, i went to the docs to see how to create a simple connection and load some data but i keep getting this: { "data":[]} has the response of my .php file. My code is:

<?php

   include('connector-php/codebase/scheduler_connector.php');

   $pdo=mysqli_connect("localhost","root","pass","hotel");

   $scheduler = new JSONSchedulerConnector($pdo);

   $scheduler->render_table("TipoQuarto","idTipoQuarto","Nome,Preco");

   echo scheduler;

?>

For now i´m just working on the .php file to see if the connector can find my data, and i know there is data there. My database has several tables, so i´m selecting the TipoQuarto, then the id of the field(idTipoQuarto) and then the fields i need, but it´s not displaying anything. Can anyone help me?

Regards.


Solution

  • For MySQLi server side code will look like next

    require("connector/scheduler_connector.php");
    require("connector/db_mysqli.php");
    $mysqli =mysqli_connect("localhost","root","pass","hotel");
    
    $scheduler = new JSONSchedulerConnector($mysqli, "MySQLi");
    $scheduler->render_table("TipoQuarto","idTipoQuarto","Nome,Preco");
    
    • you need to include db_mysqli.php
    • second parameter of constructor must be "MySQLi"

    Also, in render table, third paremeter mast include start date, end date and text fields. You are providing only two of them.