unable to update data in MySql

I am able to load data from my MySQL database. I cannot cause new data or updates to save back to the database. This is my second day with my own code working (somewhat). What am I missing? My log file does not work either. So far, I have not found an answer in the documentation or in the forum.

Any help is greatly appreciated,
texhood

In html page:

In data processor:

<?php include ('codebase/connector/gantt_connector.php'); include ("./config.php"); $res=mysql_connect("localhost","xxxxxx","yyyyyyyyyyyy"); mysql_select_db("gantttest"); $gantt = new JSONGanttConnector($res); $gantt->render_links("gantt_links","id","source,target,type"); $gantt->render_table( "gantt_tasks", "id", "start_date,duration,text,progress,sortorder,parent" ); $gantt->enable_log("d:\log.txt"); ?>

You are using your own parameter name on client side

dp.action_param = "dhx_editor_status";

Server side code need to be configure for such mode as well

//add this line before any other connector's configuration DataProcessor::$action_param ="dhx_editor_status";

My lack of experience with PHP is probably at fault here…
I put the suggested line into my data processor so:

<?php include ('codebase/connector/gantt_connector.php'); include ("./config.php"); DataProcessor::$action_param ="dhx_editor_status"; $res=mysql_connect("localhost","xxxxxx","yyyyyyyy"); mysql_select_db("gantttest"); $gantt = new JSONGanttConnector($res); $gantt->render_links("gantt_links","id","source,target,type"); $gantt->render_table( "gantt_tasks", "id", "start_date,duration,text,progress,sortorder,parent" ); $gantt->enable_log("d:\log.txt"); ?>

I can fetch data with no problem. Inserts, Updates, and Deletes still don’t work. I also commented out the dp.action_param in my javascript, but still was unable to put data into the database.

texhood

Move enable_log command before render_table, it will fix logging and you will have some debug info in the log.txt

If reason of problem is still not clear - please provide the content of the log file.

Logging statement moved. Log contents:

====================================
Log started, 22/07/2014 06:39:49

SELECT id,start_date,duration,text,progress,sortorder,parent,finish_date,priority,resource_name,outline_number,summary,project,predecessors FROM gantt_tasks

SELECT id,source,target,type FROM gantt_links

Done in 0.0091168880462646s

====================================
Log started, 22/07/2014 06:40:00

DataProcessor object initialized
1406075994870_text => New task
1406075994870_start_date => 2014-7-24 00:00
1406075994870_duration => 1
1406075994870_progress => 0
1406075994870_parent => 1
1406075994870_id => 1406075994870
1406075994870_end_date => 2014-7-25 00:00
1406075994870_!nativeeditor_status => inserted
ids => 1406075994870

Row data [1406075994870]
text => New task
start_date => 2014-7-24 00:00
duration => 1
progress => 0
parent => 1
id => 1406075994870
end_date => 2014-7-25 00:00
!nativeeditor_status => inserted

exception ‘Exception’ with message ‘Status of record [1406075994870] not found in incoming request’ in D:\Sandbox\Projects\GanttChart\GanttChart\codebase\connector\dataprocessor.php:72
Stack trace:
#0 D:\Sandbox\Projects\GanttChart\GanttChart\codebase\connector\dataprocessor.php(93): DataProcessor->get_operation(‘1406075994870’)
#1 D:\Sandbox\Projects\GanttChart\GanttChart\codebase\connector\gantt_connector.php(294): DataProcessor->process(Object(DataConfig), Object(DataRequestConfig))
#2 D:\Sandbox\Projects\GanttChart\GanttChart\codebase\connector\base_connector.php(410): JSONGanttConnector->render()
#3 D:\Sandbox\Projects\GanttChart\GanttChart\data.php(17): Connector->render_table(‘gantt_tasks’, ‘id’, ‘start_date,dura…’)
#4 {main}

Edit operation finished

Done in 0.013827800750732s

exception ‘Exception’ with message ‘Status of record [1406075994870] not found in incoming request’

Please double-check that you are using custom name for action parameter on both client and server side or not using it in both places. The above error occurs when dataprocessor can’t locate the action parameter. According to the log - parameter does exists, maybe you still have DataProcessor::$action_param code on the server side.

There were multiple issues:

  1. the parameter - I got it out of everything
  2. table structure - I had defined additional fields in my table, but do not yet know enough about how to add them into dhtmlsGantt. That will be a future area of study.
  3. sortorder field - dhtmlxGantt did not want the field to be an integer. It also would not allow its removal. I changed the field to varchar(6) and got my first Insert!\

Thank you for the help and the patience. This endeavor is a completely new set of languages and coding concepts for me.

Now, I can get on to exploring the tool more fully. Yeah!

texhood

I had defined additional fields in my table, but do not yet know enough about how to add them into dhtmlsGantt. That will be a future area of study.

Just mention them in the third parameter of render_table ( render_sql ), they will be loaded on client side along with default fields.

sortorder field - dhtmlxGantt did not want the field to be an integer
Its quite strange, in our case it is an iteger and works fine
docs.dhtmlx.com/gantt/desktop__s … deroftasks
Maybe something DB specific.