Not Inserting/Updating Correctly

I use this code to display all the tooling a contact has based on the parentID. The code selects the correct data and displays but will not insert or updates using the same code.

The log displays that C_ID is null. Even though the parentID is sent is 4.

Do you have to write separate update and inserts when you pass parameters ?

I am using a Version 3.5 Pro

<?php
 
require_once("../codebase/connector/grid_connector.php");// includes the appropriate connector 
require_once("../codebase/connector/options_connector.php");// includes the appropriate connector 
 
$dbcon = mysql_connect("localhost","usrnam","passwd");//connects to a server that contains the desired DB
mysql_select_db("dmn_crm");// connects to the DB. 'tasks' is the name of our DB

$grid = new GridConnector($dbcon,"MySQL");// connector initialization
$grid->enable_log("talloc.log",true);

$options = new OptionsConnector($dbcon);
$options->render_table("TBL_TOOLS","ID","ID (value),TOOL (label)");
$grid->set_options("T_ID",$options);

$sqltext = "SELECT * FROM TBL_TOOL_ALLOCATION WHERE C_ID = ".$_GET['parentID'];

$grid->render_sql($sqltext,"ID","C_ID,T_ID,MAKE,OWNER,MODEL,SERIAL,SENSOR_NO,CAL_CERT_DATE,ARQIVA_CERT,ALLOCATED,NOTES,ACTIONS,CERT");
?>

I have fixed the updating part that was an issue with the parameter name different from the initial load.

The problem with the insert is that I needed to create a hidden column to hold the contactID and populate the cell as part of the .addRow() parameters.

Sorry but i’m not quite sure how contactID related to the field in your current php code, is it C_ID ?

a) You can define custom update|insert query which will exclude unnecessary fields
or
b) You can have custom beforeProcessing handler which will set contactID value during insert operation, before saving to DB ( so you will need not to set it on client during addRow )