Scheduler - No events shown with Connector

Hello

A few years ago i was using Scheduler 2.5 and now upgraded to 5.0.
I tried to configure the Connection like before but got an error and no events. I really Need help and that someone explain me what i’m doing wrong.

// init Scheduler
scheduler.init('scheduler_here',new Date(),"week");
scheduler.load("../../../dhtmlx/Scheduler/php/events.php");

// events.php
include("../../../dhtmlx/Scheduler/codebase/scheduler_connector.php");

$db = mysqli_connect($hostname, $username, $password) or die ("ERROR: No Connection!");
mysqli_select_db($db, $database);

$scheduler = new SchedulerConnector($db,"MySQL");
$scheduler->render_table("termine","termin_id","start_date,end_date,text");

This is the error i get:

Fatal error: Uncaught Exception: DB class not found: MySQL in /kunden/531297_42329/webseiten/ev1/main/dhtmlx/Scheduler/codebase/base_connector.php:356 Stack trace: #0 /kunden/531297_42329/webseiten/ev1/main/dhtmlx/Scheduler/codebase/scheduler_connector.php(78): Connector->__construct(Object(mysqli), ‘MySQL’, ‘SchedulerDataIt…’, ‘SchedulerDataPr…’, ‘RenderStrategy’) #1 /kunden/531297_42329/webseiten/ev1/main/dhtmlx/Scheduler/php/events.php(18): SchedulerConnector->__construct(Object(mysqli), ‘MySQL’) #2 {main} thrown in /kunden/531297_42329/webseiten/ev1/main/dhtmlx/Scheduler/codebase/base_connector.php on line 356

Thank you for any help.
Oliver

Please ?

I think i forget something really simple because maybe the loading routine changed.

Thank you
Oliver

Hi,

if you are using mysqli, the next line must be changed

$scheduler = new SchedulerConnector($db,"MySQL");

as

require_once("db_mysqli.php");
$scheduler = new SchedulerConnector($db, "MySQLi");

Hello Stanislav

Thank you for reply.

Then i get a fatal error:

Fatal error : Class ‘MySQLDBDataWrapper’ not found in /dhtmlx/Connector/db_mysqli.php on line 8

Best regards
Oliver

Double-check the second parameter here, it must be “MYSQLi” with “i” at the end.
If you are using any other connectors ( options, etc. ) be sure that they are using the correct type as well.

yes … it is “MySQLi”

Here is the whole source:

session_start();

require_once("../../../dhtmlx/Connector/db_mysqli.php");
include("../../../dhtmlx/Scheduler/codebase/scheduler_connector.php");

$db = mysqli_connect($hostname, $username, $password) or die ("ERROR: No Connection!");
mysqli_select_db($db, $database);

$scheduler = new SchedulerConnector($db,"MySQLi");
$scheduler->render_table("termine","termin_id","start_date,end_date,text");

EDIT

I think first mistake is that i have to load scheduler_connector.php before db_mysqli.php:

require_once("../../../dhtmlx/Scheduler/codebase/scheduler_connector.php");
require_once("../../../dhtmlx/Connector/db_mysqli.php");

But then i get a new error:

Fatal error: Cannot declare class DBDataWrapper, because the name is already in use in /dhtmlx/Connector/db_common.php on line 1057

EDIT #2

I found the following topic where i understand a problem with db_mysql.php

https://github.com/DHTMLX/connector-php/pull/16

I did like in the topic above explained. I included db_common.php in db_mysql.php, db_mysql.php in db_mysqli.php and deleted db_common.php in db_mysqli.php. But now got a new error :frowning:

Fatal error: Cannot declare class EventMaster, because the name is already in use in /dhtmlx/Scheduler/codebase/tools.php on line 9

Any ideas ?

I really need to get this work :frowning:

Thank you

Please grab the updated file
https://raw.githubusercontent.com/DHTMLX/connector-php/master/codebase/db_mysqli.php

There really was an issue with dependencies.
After that, the initial init code must work correctly

require_once("db_mysqli.php");
$scheduler = new SchedulerConnector($db, "MySQLi");

Hello Stanislav

Fatal error: Cannot declare class EventMaster, because the name is already in use in /dhtmlx/Scheduler/codebase/tools.php on line 9

Hi,

I just made the next stesp locally


	include ('../../codebase/scheduler_connector.php');
	include ('../../codebase/db_mysqli.php');


    $res = mysqli_connect($mysql_server,$mysql_user,$mysql_pass, $mysql_db); 
    
	$scheduler = new SchedulerConnector($res, "MYSQLi");
	$scheduler->render_table("events","event_id","start_date,end_date,event_name,details");

And it renders data correctly. If it still causes the issue on your side, can you share the exact version of php in your case.

Hi

Fatal Error is gone but it’s still not loading my events. My PHP Version is 7.0.24

echo "1";
require_once("../../../dhtmlx/Connector/db_mysqli.php");
echo "2";
require_once("../../../dhtmlx/Connector/scheduler_connector.php");
echo "3";

There is no more fatal error but i never reach “3” and it’s the same if i put scheduler_connector.php before db_mysqli.php

OK … seems to be normal because i got a log-file where it says that there is an error because of Header modification. I deleted the echos and now it’s working :slight_smile:

Thank you so much for your help

Best regards
Oliver