DHTMLX / connector-php

PHP extension for the DHTMLX library
http://dhtmlx.com/docs/products/dhtmlxConnector/index.shtml
GNU General Public License v3.0
26 stars 29 forks source link

does DHTMLX connector support PHP7 ? #15

Closed jpoloczek closed 7 years ago

jpoloczek commented 7 years ago

Hi,

We have a project that uses some DHTMLX components. Updated to Ubuntu 16.04 that has only PHP7 and DHTMLX stopped working. Please advice.

thanks, Janusz

sergeysid commented 7 years ago

Hey Janusz, Is DHTMLX showing any errors? there should be something in your log

yella-reddy commented 7 years ago

Hi, DHTMLX scheduler not working after php7 upgrade.

Changed mysql connection "mysql_connect" to "mysqli_connect" getting bellow error:

Log started, 28/04/2017 06:37:30

!!!Uncaught Exception Code: 0 Message: Call to undefined function mysql_real_escape_string()

AlexKlimenkov commented 7 years ago

It's the default mysql database adapter that causes the issue - it's built on php_mysql api which no longer there in php7 https://wiki.php.net/rfc/remove_deprecated_functionality_in_php7 https://docs.dhtmlx.com/connector__php__server_side_sample.html

Luckily, you can easily switch it to either mysqli or PDO adapters which should work fine, e.g.:

require_once('connector/scheduler_connector.php');
require_once ('connector/db_pdo.php');

$res = new PDO("mysql:host=localhost;dbname=schedulertest", "scheduler", "scheduler");

$dbtype = "PDO";//!important

$scheduler = new schedulerConnector($res, $dbtype);

usually, no other changes required.

Changed mysql connection "mysql_connect" to "mysqli_connect" getting bellow error:

Be sure to pass the connection type to the second argument of the constructor $scheduler = new schedulerConnector($res, "MySQLi"); You can find all supported options here https://docs.dhtmlx.com/connector__php__server_side_sample.html

AlexKlimenkov commented 7 years ago

Default connection type has been changed to PDO https://github.com/DHTMLX/connector-php/commit/8b5f2010bbc463f362bd2e52e2c6625dd45c6861

chrismart123 commented 6 years ago

Hi Im using Dhtmlx Scheduler, but seems i can connect to the live database, itried using the code below but its not working..

data.php require_once(dirname(FILE).'/lib/dhtmlxScheduler/connector/scheduler_connector.php'); include('./config.php'); $scheduler = new JSONSchedulerConnector($res,$dbtype); $roomtypes = new JSONOptionsConnector($res, "PDO"); $roomtypes->render_table("ns_room_types","idx","idx(value),room_name(label),name"); $scheduler->set_options("roomType", $roomtypes);

config.php require_once(dirname(FILE).'/lib/dhtmlx_codebase/connector/db_pdo.php'); $dbtype = "PDO"; $res = new PDO("mysql:dbname=felladmin;host=localhost","xxx","xxx")

this is not displayig or retrieving any data, but if i tried this other code

// require_once('./lib/dhtmlx_codebase/connector/dataview_connector.php'); // $conn = new PDO("mysql:dbname=felladmin;host=localhost","felladmin","Fella@talamban"); // $data = new DataViewConnector($conn); // $data->render_table("ns_room_types","idx","idx(value),room_name(label),name");

this retrieves data, why is the scheduler_connector not working? im working in the live server, but im my local seems to be working fine, hope to hear from you soon.