Failure to create events PHP PDO connector


#1

I changed from mysql_connect to PDO since PHP7 no longer supports mysql_connect.
I can render the scheduler properly, and can revise and move pre-existent events to the database, but when I create a new event it shows in red and does not write the data back to the database.

I have been trying to figure out how to fix this problem.
Any help would be appreciated.

Thanks,

========================================================

The following are the new substitutions with the code working on PHP5 previously:

For Loading data:
events.php

<?php include ('../codebase/connector/scheduler_connector.php'); include ('../codebase/connector/db_pdo.php'); include ('../common/config.php'); // $res=mysql_connect($server, $user, $pass); $res=new PDO("mysql:host=localhost;dbname=db1", $user, $pass); $dbtype = "PDO"; // mysql_select_db("db1"); $scheduler = new schedulerConnector($res, $dbtype); //$scheduler->enable_log("log.txt",true); $scheduler->render_table("events","event_id","start_date,end_date,event_name,details,rec_type,event_pid,event_length"); //$scheduler->render_table("events","event_id","start_date,end_date,event_name,details,section_id"); ?>

===================
scheduler.init(‘scheduler_here’,null,“month”);
scheduler.load("…/php/events.php?uid="+scheduler.uid());======================

For Connecting to dataprocessor on scheduler initialization:
scheduler.init(‘scheduler_here’,null,“month”);
scheduler.load("…/php/events.php?uid="+scheduler.uid());


#2

Here is the error log file: had to increase event_id size as 13 was too small and resulted in an error.
After doing this, and looking at log.txt I get another error:

====================================
Log started, 30/06/2020 10:09:44

DataProcessor object initialized
1593550409072_start_date => 2020-06-27 08:00
1593550409072_end_date => 2020-06-27 09:00
1593550409072_text => test descrition
1593550409072_id => 1593550409072
1593550409072_event_pid =>
1593550409072_event_length =>
1593550409072_rec_pattern =>
1593550409072_rec_type =>
1593550409072_details => Notes
1593550409072_!nativeeditor_status => inserted
ids => 1593550409072

Row data [1593550409072]
start_date => 2020-06-27 08:00
end_date => 2020-06-27 09:00
event_name => test descrition
event_id => 1593550409072
event_pid =>
event_length =>
rec_pattern =>
rec_type =>
details => Notes
!nativeeditor_status => inserted

INSERT INTO events(start_date,end_date,event_name,details,rec_type,event_pid,event_length) VALUES (‘2020-06-27 08:00’,‘2020-06-27 09:00’,‘test descrition’,‘Notes’,’’,’’,’’)

Exception: PDO - sql execution failed
Incorrect integer value: ‘’ for column valleyra_rconf.events.event_pid at row 1 in /var/www/html/sch/cal/codebase/connector/db_pdo.php:20
Stack trace:
#0 /var/www/html/sch/cal/codebase/connector/db_common.php(721): PDODBDataWrapper->query()
#1 /var/www/html/sch/cal/codebase/connector/dataprocessor.php(221): DBDataWrapper->insert()
#2 /var/www/html/sch/cal/codebase/connector/dataprocessor.php(168): DataProcessor->check_exts()
#3 /var/www/html/sch/cal/codebase/connector/dataprocessor.php(97): DataProcessor->inner_process()
#4 /var/www/html/sch/cal/codebase/connector/base_connector.php(492): DataProcessor->process()
#5 /var/www/html/sch/cal/codebase/connector/base_connector.php(411): Connector->render()
#6 /var/www/html/sch/cal/php/rconf_events.php(14): Connector->render_table()
#7 {main}

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

Done in 0.0029089450836182s

====================================
Log started, 30/06/2020 10:09:49

SELECT event_id,start_date,end_date,event_name,details,rec_type,event_pid,event_length FROM events

Done in 0.053054094314575s