Trying to get property of non-object at db_phpci.php line 56


I’m a newbie on dhtmlx using it for the first time. I accomplished to have a basic scheduler, integrated with the PHP CodeIgniter framework getting data from the database (MySQL).

I activated the log on the connector ($conn->enable_log(“temp.log”):wink: and I see these messages every time an event is inserted/updated/deleted:

UPDATE events SET `start_date`='2013-11-15 00:00',`end_date`='2013-11-15 00:05',`text`='Professional: Professional: Test' WHERE `id`='5' Trying to get property of non-object at C:\xampp\htdocs\girh_gt\assets\dhtmlx\dhtmlxConnector\codebase\db_phpci.php line 56 Trying to get property of non-object at C:\xampp\htdocs\girh_gt\assets\dhtmlx\dhtmlxConnector\codebase\db_phpci.php line 57 Edit operation finished 0 => action:updated; sid:5; tid:5; Done in 0.019180059432983s

The vent is modified OK, but I’d like to know why this error is happening. Any idea?

The code of the connector:

$this->load->database(); $conn = new SchedulerConnector($this->db, "PHPCI"); $conn->enable_log("temp.log"); $conn->configure("events","id","start_date,end_date,text", "professional"); $conn->render();

Are you using live updates in the scheduler ?
I don’t see how such error can occurs in the case of basic scheduler initialization.

By live updates do you mean attaching the PHP connector? Yes, I’m using it. The complete scheduler initialization:

[code]scheduler.config.multi_day = true;
scheduler.config.xml_date="%Y-%m-%d %H:%i";
scheduler.config.show_loading = true;
scheduler.config.start_on_monday = true;
scheduler.config.active_link_view = “day”;
scheduler.init(‘scheduler_here’, new Date(),“month”);

scheduler.setLoadMode(“year”); // Carrega dades dinàmicament, per no sobrecarregar. Es pot especificar month, week, …
scheduler.load(“<?php echo base_url(); ?>scheduler/scheduler/get_events”);
var dp = new dataProcessor(“<?php echo base_url(); ?>scheduler/scheduler/get_events”);
dp.action_param =“dhx_editor_status”;

Am I doing something wrong?

You are using custom name of data action parameter

dp.action_param ="dhx_editor_status";

Do you have the pair instruction in the php code ?

DataProcessor::$action_param ="dhx_editor_status";

By live updates do you mean attaching the PHP connector?
Live update is a special mode, in which scheduler can update data automatically, when it was changed on the server side ( as far as I can see - this mode is not used )

Yes, I’ve it, I followed the instructions for the CodeIgniter integration of the DHTMLX wiki: … odeigniter

Can I do some tests or give you more information about that error? Maybe it is a bug?

PD> And no, I don’t have live update enabled (but is very interesting!).

Please send me a full code of client side page with scheduler initialization and server side connector’s code ( preferable as attachment ), I will try to reconstruct the same issue locally.

Also, just to be sure, try to update connector files with latest version from github

I tried with the last github version and the same error happen. I uploaded the basic code here:

I’ve a different implementation using CI Model instead, and these errors have gone, but I have others when I init the scheduler:

Undefined variable: config at C:\xampp\htdocs\girh_gt\assets\dhtmlx\dhtmlxConnector\codebase\db_common.php line 500
Undefined variable: connection at C:\xampp\htdocs\girh_gt\assets\dhtmlx\dhtmlxConnector\codebase\db_common.php line 501

The code of this implementation:

Many many thx!

Which version of PHP you are using ?
I have tried to run the same code locally and it works correctly :frowning:

Also, it seems that you are using not latest code in second case, as error line numbers are not valid. ( but I don’t thing that update will fix anything, as I can’t see how the above error messages can appear in old code as well )

I’m developing using XAMPP for Windows with PHP 5.3.8.

I’ll try to investigate the errors of the 2n case with other versions of the connector.

For the first problem for “Trying to get property of non-object at db_phpci.php line 56” or line 52 : it lacks some test on function “public function __construct($res)”.
You must control if $res is an object to have access to properties $res->num_rows and $res->current_row.
On db_phpci.php file, add in the PHPCIResultSet’s constructor this lines :

$this->count = ‘’;
$this->start = ‘’;
$this->count = $res->num_rows;
$this->start = $res->current_row;
Thus, you are no such problem. It would be a good idea to add this on the latest version.
Have a good day.

Since the first post, I’ve this error yet on every scheduler load, seen in conn.log:

Trying to get property of non-object at (...)\dhtmlx\dhtmlxConnector\codebase\db_common.php line 1041

I hope someone can look at your suggestion.

Thanks for the problem report.
Fix added to the dev version and will be included in the next build.

Please try latest version from here, it has fix for the related error

Tried with the latest version and now the warning is gone, thx!