PHP Server Side
I use an sql string to populate a checkbox in the grid and works fine.
Then I manually update a cell and go to update the database and it fails as column RET does not exist in the update. How can I just update the cell that was changed.
<?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","tooling","tooling");//connects to a server that contains the desired DB
mysql_select_db("dmn_dr");// connects to the DB. 'tasks' is the name of our DB
$tool = new OptionsConnector($dbCon);
$tool->render_table("tbltools","ID","ID (value), TOOL (label)");
$myGrid = new GridConnector($dbCon,"MySQL");// connector initialization
$myGrid->enable_log("LEAVERS_TOOLS.LOG", true);
$sql = "SELECT *,1 as RET FROM tblallocatetools WHERE C_ID=".$_GET['engineer'];
$myGrid->set_options("T_ID",$tool);
$myGrid->render_sql($sql,"ID","C_ID,RET,T_ID,MAKE,MODEL,SERIAL");// data configuration
?>
Code Snippet Client Side
frmLeavers.attachEvent("onButtonClick", function(id) {
var dp = new dataProcessor('php/Staff/leaverEquip.php?engineer='+gridDMN.getSelectedRowId());
dp.init(gridLeavers);
gridLeavers.forEachRow(function(id){
var ret = gridLeavers.cells(id,1).isChecked();
if(ret) {
gridLeavers.cells(id,0).setValue("160");
dp.setUpdated(id,true);
}
frmLeavers.unload();
leaversWindow.close();
});
});
Log File:
====================================
Log started, 25/04/2013 01:04:44
====================================
SELECT `ID`,`ID` as value,`TOOL` as label FROM tbltools
SELECT *,1 as RET FROM tblallocatetools WHERE ( C_ID=1)
Done in 0.02897310256958s
====================================
Log started, 25/04/2013 01:04:48
====================================
DataProcessor object initialized
550_gr_id => 550
550_c0 => 160
550_c1 => 1
550_c2 => 12
550_c3 =>
550_c4 =>
550_c5 =>
550_!nativeeditor_status => updated
ids => 550
Row data [550]
ID => 550
C_ID => 160
RET => 1
T_ID => 12
MAKE =>
MODEL =>
SERIAL =>
!nativeeditor_status => updated
UPDATE tblallocatetools SET `C_ID`='160',`RET`='1',`T_ID`='12',`MAKE`='',`MODEL`='',`SERIAL`='' WHERE `ID`='550' AND (( C_ID=1))
====================================
Log started, 25/04/2013 01:04:48
====================================
exception 'Exception' with message 'MySQL operation failed
Unknown column 'RET' in 'field list'' in C:\xampp\htdocs\ToolApp\codebase\connector\db_common.php:965
Stack trace:
#0 C:\xampp\htdocs\ToolApp\codebase\connector\db_common.php(637): MySQLDBDataWrapper->query('UPDATE tblalloc...')
#1 [internal function]: DBDataWrapper->update(Object(DataAction), Object(DataRequestConfig))
#2 C:\xampp\htdocs\ToolApp\codebase\connector\dataprocessor.php(222): call_user_func(Array, Object(DataAction), Object(DataRequestConfig))
#3 C:\xampp\htdocs\ToolApp\codebase\connector\dataprocessor.php(173): DataProcessor->check_exts(Object(DataAction), 'update')
#4 C:\xampp\htdocs\ToolApp\codebase\connector\dataprocessor.php(102): DataProcessor->inner_process(Object(DataAction))
#5 C:\xampp\htdocs\ToolApp\codebase\connector\base_connector.php(475): DataProcessor->process(Object(DataConfig), Object(DataRequestConfig))
#6 C:\xampp\htdocs\ToolApp\codebase\connector\base_connector.php(432): Connector->render()
#7 C:\xampp\htdocs\ToolApp\php\Staff\leaverEquip.php(17): Connector->render_sql('SELECT *,1 as R...', 'ID', 'C_ID,RET,T_ID,M...')
#8 {main}
Edit operation finished
0 => action:error; sid:550; tid:550;
Done in 0.016445875167847s