Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Rainolf on Sep 15, 2009 13:19
open dhtmlx forum
Could be a problem updating row when?

Hello,
i'm tring to use a sample grid code posted in knoledge base to retrieve data from mysql database.

i'm using a simple grid with dataprocessor features....

htlm page....
get.php to load data from mysql
update.php to update edited records.

All works fine except when in my table there's a timestamp field. Y-m-d HH:mm:ss .

In that case the data are not updated..i've tried to use dataprocessor's debug features but it says to me: " update,valid".

Have i missed something or is there particular code to add or maybe known bug?

Thank u for answer
Answer posted on Sep 16, 2009 04:51
dhtmlxGrid and dhtmlxDataProcessro are fully client side components. To save correctly values from grid to your data base you should convert on server side data to the necessary format. 
Answer posted by Rainolf on Sep 16, 2009 05:16
Sure......i do it

function update_row(){
    $sql =     "UPDATE hs_hr_attendance SET  punchin_time='".$_GET["c0"]."',
                in_note=        '".addslashes($_GET["c1"])."',
                punchout_time=        '".addslashes($_GET["c2"])."',
                out_note=        '".$_GET["c3"]."',
                status=    '".$_GET["c4"]."'
            WHERE attendance_id=".$_GET["gr_id"];
    $res = mysql_query($sql);
   
    return "update";   
}

//include XML Header (as response will be in xml format)
header("Content-type: text/xml");
//encoding may differ in your case
echo('<?xml version="1.0" encoding="iso-8859-1"?>');


$mode = $_GET["!nativeeditor_status"]; //get request mode
$rowId = $_GET["gr_id"]; //id or row which was updated
$newId = $_GET["gr_id"]; //will be used for insert operation


switch($mode){
    case "inserted":
        //row adding request
        $action = add_row();
    break;
    case "deleted":
        //row deleting request
        $action = delete_row();
    break;
    default:
        //row updating request
        $action = update_row();
    break;
}

the code work perfectly only when in mysql table are not present timestamp value....