Updating ms access database dateformating error

Hi Guys,

Fairly new to web dev and scripting so apologies if its obvious.

running gantt and using php/pdo connector/processor to get to a ms access (.accdb) which i can get to fetch the data but using processor i get the error at the bottom.

so what i think is happening is that the gantt is giving the date in the format: “2016/06/30 14:00:00” when i actually need it in: “12/06/2012 13:04:00” for MS access.

code for updating is:

else {//code for other operations - i.e. update/insert/delete
$sql = “SELECT tblData.DataId AS id,tblData.DataTargetDateTime FROM tblData” ;
$id = “tblData.DataId”;
//$text = “TO_TIMESTAMP(tblData.DataTargetDateTime, dd/MM/yyyy HH:mm:ss)”;
$text = “tblData.DataTargetDateTime”;

as you can see i tried to format using to_timestamp but that didnt work as i think dhtmlx messes with it before it gets to running the sql query. any help would be great?


DataProcessor object initialized
5011_id => 5011
5011_start_date => 2016/06/30 14:00:00
5011_duration => 500
5011_text => hello
5011_progress => 0.5
5011_end_date => 2016/07/01 12:20:00
5011_parent => 0
5011_!nativeeditor_status => updated
ids => 5011

Undefined offset: 1 at C:\inetpub\wwwroot\FieryApp\TESTSERVER\codebase\connector\gantt_connector.php line 223

Undefined offset: 2 at C:\inetpub\wwwroot\FieryApp\TESTSERVER\codebase\connector\gantt_connector.php line 228

Undefined offset: 1 at C:\inetpub\wwwroot\FieryApp\TESTSERVER\codebase\connector\gantt_connector.php line 225

Row data [5011]
tblData.DataId => 5011
tblData.DataTargetDateTime => 2016/06/30 14:00:00
duration => 500
=> hello
progress => 0.5
end_date => 2016/07/01 12:20:00
parent => 0
!nativeeditor_status => updated

UPDATE tblData SET tblData.DataTargetDateTime=‘2016/06/30 14:00:00’ WHERE tblData.DataId=‘5011’

exception ‘Exception’ with message ‘PDO - sql execution failed
[Microsoft][ODBC Microsoft Access Driver] Data type mismatch in criteria expression. (SQLExecute[-3030] at ext\pdo_odbc\odbc_stmt.c:254)’ in C:\inetpub\wwwroot\FieryApp\TESTSERVER\codebase\connector\db_pdo.php:20
Stack trace:
#0 C:\inetpub\wwwroot\FieryApp\TESTSERVER\codebase\connector\db_common.php(743): PDODBDataWrapper->query(‘UPDATE tblData …’)
#1 [internal function]: DBDataWrapper->update(Object(DataAction), Object(DataRequestConfig))
#2 C:\inetpub\wwwroot\FieryApp\TESTSERVER\codebase\connector\dataprocessor.php(221): call_user_func(Array, Object(DataAction), Object(DataRequestConfig))
#3 C:\inetpub\wwwroot\FieryApp\TESTSERVER\codebase\connector\dataprocessor.php(168): DataProcessor->check_exts(Object(DataAction), ‘update’)
#4 C:\inetpub\wwwroot\FieryApp\TESTSERVER\codebase\connector\dataprocessor.php(97): DataProcessor->inner_process(Object(DataAction))
#5 C:\inetpub\wwwroot\FieryApp\TESTSERVER\codebase\connector\gantt_connector.php(180): DataProcessor->process(Object(DataConfig), Object(DataRequestConfig))
#6 C:\inetpub\wwwroot\FieryApp\TESTSERVER\codebase\connector\base_connector.php(448): GanttConnector->render()
#7 C:\inetpub\wwwroot\FieryApp\TESTSERVER\gantt_connector_v3.php(41): Connector->render_sql(‘SELECT tblData…’, ‘tblData.DataId’, ‘tblData.DataTar…’)
#8 {main}

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

Done in 0.050469160079956s

You can attach a code to the connector, which will be called each time before saving data. It can be used to format date fields in the necessary way

docs.dhtmlx.com/connector__php__ … event.html
docs.dhtmlx.com/connector__php__ … event.html