Database error

Hello,

I’m trying to make my first Gantt connected to a Mysql Database with PHP.
I followed all the steps to get started, and my gantt is showing up, but when I try to add my first task it doesn’t save to database. When I refresh, all my tasks are lost. When I add tasks, I check in the database and there is nothing in it, so there is a problem with the mysql connection.

When I check the response of data.php when I add a task it is : “”

I tried to enable logs in data.php and it says :

====================================
Log started, 08/04/2015 02:43:27

SELECT id,start_date,duration,text,progress,sortorder,parent FROM gantt_tasks

SELECT id,source,target,type FROM gantt_links

Done in 0.0090010166168213s

====================================
Log started, 08/04/2015 02:43:27

SELECT id,start_date,duration,text,progress,sortorder,parent FROM gantt_tasks

SELECT id,source,target,type FROM gantt_links

Done in 0.019001960754395s

====================================
Log started, 08/04/2015 02:43:28

SELECT id,start_date,duration,text,progress,sortorder,parent FROM gantt_tasks

SELECT id,source,target,type FROM gantt_links

Done in 0.018002033233643s

====================================
Log started, 08/04/2015 02:43:41

DataProcessor object initialized
1428504207987_id => 1428504207987
1428504207987_start_date => 2015-04-07 00:00
1428504207987_text => New task
1428504207987_duration => 1
1428504207987_end_date => 2015-04-08 00:00
1428504207987_parent => 0
1428504207987_!nativeeditor_status => inserted
ids => 1428504207987

Row data [1428504207987]
id => 1428504207987
start_date => 2015-04-07 00:00
text => New task
duration => 1
end_date => 2015-04-08 00:00
parent => 0
!nativeeditor_status => inserted

Incorrect field name used: progress

data
id => 1428504207987
start_date => 2015-04-07 00:00
text => New task
duration => 1
end_date => 2015-04-08 00:00
parent => 0
!nativeeditor_status => inserted

Incorrect field name used: progress

data
id => 1428504207987
start_date => 2015-04-07 00:00
text => New task
duration => 1
end_date => 2015-04-08 00:00
parent => 0
!nativeeditor_status => inserted

Incorrect field name used: sortorder

data
id => 1428504207987
start_date => 2015-04-07 00:00
text => New task
duration => 1
end_date => 2015-04-08 00:00
parent => 0
!nativeeditor_status => inserted

Incorrect field name used: sortorder

data
id => 1428504207987
start_date => 2015-04-07 00:00
text => New task
duration => 1
end_date => 2015-04-08 00:00
parent => 0
!nativeeditor_status => inserted

INSERT INTO gantt_tasks(start_date,duration,text,progress,sortorder,parent) VALUES (‘2015-04-07 00:00’,‘1’,‘New task’,’’,’’,‘0’)

exception ‘Exception’ with message ‘MySQL operation failed
Data truncated for column ‘progress’ at row 1’ in C:\wamp\www\gantt\dhtmlxGantt_v3.2.0_gpl\codebase\connector\db_common.php:1091
Stack trace:
#0 C:\wamp\www\gantt\dhtmlxGantt_v3.2.0_gpl\codebase\connector\db_common.php(721): MySQLDBDataWrapper->query(‘INSERT INTO gan…’)
#1 [internal function]: DBDataWrapper->insert(Object(DataAction), Object(DataRequestConfig))
#2 C:\wamp\www\gantt\dhtmlxGantt_v3.2.0_gpl\codebase\connector\dataprocessor.php(221): call_user_func(Array, Object(DataAction), Object(DataRequestConfig))
#3 C:\wamp\www\gantt\dhtmlxGantt_v3.2.0_gpl\codebase\connector\dataprocessor.php(168): DataProcessor->check_exts(Object(DataAction), ‘insert’)
#4 C:\wamp\www\gantt\dhtmlxGantt_v3.2.0_gpl\codebase\connector\dataprocessor.php(97): DataProcessor->inner_process(Object(DataAction))
#5 C:\wamp\www\gantt\dhtmlxGantt_v3.2.0_gpl\codebase\connector\gantt_connector.php(294): DataProcessor->process(Object(DataConfig), Object(DataRequestConfig))
#6 C:\wamp\www\gantt\dhtmlxGantt_v3.2.0_gpl\codebase\connector\base_connector.php(411): JSONGanttConnector->render()
#7 C:\wamp\www\gantt\dhtmlxGantt_v3.2.0_gpl\data.php(17): Connector->render_table(‘gantt_tasks’, ‘id’, ‘start_date,dura…’)
#8 {main}

Edit operation finished
0 => action:error; sid:1428504207987; tid:1428504207987;

Done in 0.037003040313721s

Could you please help me?

Thanks a lot

What is the type of “progress” column in the database ?

Are you using mysql with default settings ? Connector will try to store string value “1” in the progress field, which has a number type, most probably. Default mysql allows such type of conversion, but it can be configured to throw an error, similar to one in your case.

Hello and thank you for your help.

You were right, the problem was that MySQL Strict Mode was enabled. I disabled it and it works now.

Thanks again