OK so update to where I am at with this (STILL NOT WORKING). I am not convinced however that this is Chrono issue but perhaps someone can help on the MYSQL side. I have tried different things and have gotten this to do what I expect on the Chrono site using a custome code action (not PHP). See the code and the debug below.
Even though the SQL Statement shows `away_score` = 'NULL' it is getting changed to 0. Is mysql doing this (the column is set to allow NULL and a default value of NULL)?
CODE:
<?php
$away = $this->data["away_score"];
if (empty($away)) {
$away='NULL';
}
$this->data["away_score"] = $away;
?>
Array
(
[option] => com_chronoforms6
[cont] => manager
[chronoform] => tourn-game-edit
[game_id] => 92
[event] => submit
[aid] => 92
[game_start] => 2018-02-23 18:00:00
[away_score] => NULL
[home_score] =>
[location_id] => 53
[button13] =>
[intercom-lou-tvfkokak] => 1
[joomla_user_state] => logged_in
[5c8a1c575b995dbdf3c3e56651c22852] => b7ef4c221c1d34607f660b5b0ae45236
[88ce27ccca7738dcd49df6b5d9f53e1b] => 6a3a1b80edd7d0d55e45b989d80b8410
[Itemid] =>
)
Array
(
[validate_fields2] => Array
(
[log] => Automatic validation enabled.
[var] => 1
)
[save_data12] => Array
(
[data] => Array
(
[created] => 2018-02-23 17:36:19
[user_id] => 0
[aid] => 92
[game_start] => 2018-02-23 18:00:00
[away_score] => NULL
[home_score] =>
[location_id] => 53
)
[_success] => Data saved successfully
[log] => Array
(
[0] => INSERT INTO `LO_TournamentGames` (`created`, `user_id`, `aid`, `game_start`, `away_score`, `home_score`, `location_id`) values ('2018-02-23 17:36:19', '0', '92', '2018-02-23 18:00:00', 'NULL', '', '53') ON DUPLICATE KEY UPDATE `created` = '2018-02-23 17:36:19',`user_id` = '0',`aid` = '92',`game_start` = '2018-02-23 18:00:00',`away_score` = 'NULL',`home_score` = '',`location_id` = '53';
)
[var] => Array
(
[created] => 2018-02-23 17:36:19
[user_id] => 0
[aid] => 92
[game_start] => 2018-02-23 18:00:00
[away_score] => NULL
[home_score] =>
[location_id] => 53
)
)
)