Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted on Dec 15, 2009 01:51
open dhtmlx forum
update data using dataprocessor

Hello,

i m using data processor for update the row but it give me nothing below is my code please tell me what i do or some other way to update the data.


update.php

<?php
//code below is simplified - in real app you will want to have some kins session based autorization and input value checking
error_reporting(E_ALL ^ E_NOTICE);

//include db connection settings
require_once('config.php');
require_once('config_dp.php');


function update_row(){
    $sql =     "UPDATE shotTaskArtist SET checkEfficiency='".$_GET["c0"]."',
                shotID_new=        '".addslashes($_GET["c2"])."',
                taskID=        '".addslashes($_GET["c4"])."',
                TaskREF=        '".$_GET["c5"]."',
                task_note=    '".$_GET["c6"]."',
                manDays=    '".$_GET["c7"]."',
                userID=    '".$_GET["c8"]."',
                taskStatus=    '".$_GET["c9"]."'
                startDate=    '".$_GET["c10"]."'
                endDate=    '".$_GET["c11"]."'
                task_priority=    '".$_GET["c12"]."'
                actualMandays=    '".$_GET["c15"]."'
                supervisorName=    '".$_GET["c16"]."'

            WHERE id=".$_GET["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["id"]; //id or row which was updated
$newId = $_GET["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;
}


//output update results
echo "<data>";
echo "<action type='".$action."' sid='".$rowId."' tid='".$newId."'/>";
echo "</data>";

?>



<?php
    include("../../include/system/system.php");
    include("../../include/login/login_test.php");
    include("../../include/header/header.php");
    include("../../include/config/config.php");
    
    $sql = mysql_query("SELECT projID from projTable where userID='".$_SESSION[MyUserId]."'") or die(mysql_error());
    $count = mysql_num_rows($sql);
    if($count > 0) {
        while($rs = mysql_fetch_array($sql)) {
            $projIDs = $rs['projID'];
        }
    }
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>

    <script>window.dhx_globalImgPath = "codebase/imgs/";</script>
    <link rel='STYLESHEET' type='text/css' href='../dhtmlxGrid/codebase/dhtmlxgrid.css'>
    <link href='../dhtmlxGrid/codebase/ext/dhtmlxgrid_pgn_bricks.css' rel='STYLESHEET' type='text/css'>
    <link rel="STYLESHEET" type="text/css" href="../dhtmlxGrid/codebase/calendar/dhtmlxcalendar.css">
    <link rel="STYLESHEET" type="text/css" href="../../../dhtmlxCalendar/codebase/skins/dhtmlxcalendar_yahoolike.css">
    <link rel="STYLESHEET" type="text/css" href="../dhtmlxGrid/codebase/skins/dhtmlxgrid_dhx_black.css">
    <link rel='STYLESHEET' type='text/css' href='codebase/dhtmlxcombo.css'>

    <script src='../dhtmlxConnector_php/samples/common/dhtmlx.js'></script>
    <script src='../dhtmlxGrid/codebase/dhtmlxcommon.js'></script>
    <script src='../dhtmlxGrid/codebase/dhtmlxgrid.js'></script>    
    <script src='../dhtmlxGrid/codebase/dhtmlxgridcell.js'></script>    
    <script src='../dhtmlxGrid/codebase/ext/dhtmlxgrid_srnd.js'></script>    
    <script src='../dhtmlxDataProcessor/codebase/dhtmlxdataprocessor.js'></script>    
    <script src='../dhtmlxGrid/codebase/ext/dhtmlxgrid_filter.js'></script>
    <script src='../dhtmlxConnector_PHP/codebase/connector.js'></script>
    <script src="../dhtmlxGrid/codebase/calendar/dhtmlxcalendar.js"></script>
    <script src="../dhtmlxGrid/codebase/calendar/excelll/dhtmlxgrid_excell_dhxcalendar.js"></script>
    <script src='codebase/dhtmlxcombo.js'></script>
    <script src="codebase/dhtmlxcommon.js"></script>
</head>
<?php if($projIDs !="0") {?>
<body>
<?php } ?>
    <table width="100%" border="0">
     <tr><td height="10"><table width="100%" border="0">
<tr>
<td bgcolor="#004f8f"><table width="100%" border="0" bgcolor="#999999">
<tr>
<td><div id="combo_zone3" style="width:77px; height:15px;"></div></td>
<td><input type="button" style="background:#4B708D;color:#CFDCE7" name="excelSheet" value="Generate Excel Sheet" onClick="generateExcelTaskManagement(document.getDetail1.projID.value)">  
<input type="button" style="background:#4B708D;color:#CFDCE7" name="excelSheet" value="Generate Excel Sheet" onClick="generateExcelTaskManagement(document.getDetail1.projID.value)">  
<input type="button" style="background:#4B708D;color:#CFDCE7" name="excelSheet" value="Import Excel Sheet" onClick="window.open('importExcelFile.php','ImportExcel','status=no,width=450,height=140,scrollbar=yes')"></td>
</tr>
</table></td>
</tr>
</table>
</td></tr>


<?php /*$col = $_GET['colNum'];

if($col == 1) {
    $shotID = $_GET['shotID'];
    $where1 = " AND shotID='".$shotID."' ";
    $where = " AND shotID='".$shotID."' ";
}
if($col == 9) {
    $userID = $_GET['shotID'];
    $where = " AND userID='".$userID."' ";
}

echo "SELECT shotID from shot WHERE projID='$projIDs' ".$where1."";
$sql = mysql_query("SELECT shotID from shot WHERE projID='".$_GET['projID']."' ".$where1."") or die(mysql_error());
echo "ppp".$count = mysql_num_rows($sql);

$sql1 = mysql_query("SELECT sum(mandays) as mand from shotTaskArtist WHERE projID='".$_GET['projID']."' ".$where." ") or die(mysql_error());
while($rs = mysql_fetch_array($sql1)) {
    $mandays = $rs['mand'];
}
//echo "SELECT sum(dailyReport.mandays) as actMan from dailyReport LEFT JOIN shotTaskArtist ON shotTaskArtist.shotID=dailyReport.shotID WHERE dailyReport.projID='".$_GET['projID']."' ".$where." ";
//echo "SELECT sum(manDays) as actMan from dailyReport WHERE projID='".$_GET['projID']."' ".$where." ";
$sql1 = mysql_query("SELECT sum(manDays) as actMan from dailyReport WHERE taskID!='sup' and projID='".$_GET['projID']."' ".$where." ") or die(mysql_error());
while($rs = mysql_fetch_array($sql1)) {
    $actMan = $rs['actMan'];
}*/
?>
<tr><td><table width="45%"><tfoot>
    <tr><td width="10%"><strong><font color="#888888">Total Shots</font> :<?=$count?></strong></td>
    <td width="22%"><strong><font color="#888888">Total Alloted Mandays</font> : <?=number_format($mandays,2)?></strong></td>
    <td width="22%"><strong><font color="#888888">Total Actual Mandays</font> : <?=number_format($actMan,2)?></strong></td>
    <!--<td width="15%"><strong><font color="#888888">Row Count</font> : <?=number_format()?></strong></td>-->
    </tr></tfoot>
</table></td></tr>
</table>

<div id="gridbox" style="width:1208px; height:600px;">d</div>
<script>
        var z = new dhtmlXCombo("combo_zone3", "alfa3", 170);
        z.loadXML("common/test.php");
        z.attachEvent("onChange",function() {
        var selected_value=z.getActualValue();
        //alert(selected_value);
        mygrid = new dhtmlXGridObject('gridbox');
        mygrid.setImagePath('../dhtmlxGrid/codebase/imgs/');
        mygrid.clearAll(0);
        mygrid.attachHeader("Total quantity,#cspan,-,<div id='nr_q'>0</div>", ["text-align:left;"]);
        mygrid.setHeader("Check,Add/Del,ShotID,Shotstatus,TaskID,Taskref,Task-Note,Alloted Mandays,UserID,TaskStatus,StartDate,EndDate,Task Priority,Next-Sub,Last-Sub,Actual Mandays,Supervisor");
        mygrid.setColTypes("ed,link,ro,coro,ed,ed,txt,ed,ed,coro,dhxCalendarA,dhxCalendarA,ed,dhxCalendarA,dhxCalendarA,ed,ed");
        mygrid.setSkin("gray")
        mygrid.attachHeader(" , ,#connector_select_filter,#connector_select_filter,#connector_select_filter,#connector_select_filter, ,#connector_select_filter,#connector_select_filter,#connector_select_filter,#connector_select_filter,#connector_select_filter,#connector_select_filter,#connector_select_filter,#connector_select_filter,#connector_select_filter,#connector_select_filter")
        mygrid.setColSorting("connector,int,connector")
        mygrid.init();
        //mygrid.enableSmartRendering(true);
        //mygrid.enableMultiselect(true);
        mygrid.loadXML( "connector.php?projid=" + selected_value);
        var dp = new dataProcessor("php/update.php");
            dp.init(mygrid);
            
mygrid.attachEvent("onRowSelect",function(row_id,column_index){
if(column_index==1) window.open("newTask.php?shotID="+row_id, "width=700px,height=220px,left=150px,top=10px,resize=1,scrolling=0", "recal");
    })
    })



</script>
</body>
</html>
<?php
include("../../include/header/footer.php");
?>



please reply me as soonn as possible
Answer posted by dhxSupport on Dec 15, 2009 02:34
Unfortunately we cannot reproduce this issue locally. Working dataProcessor samples you can find at your dhtmlxGrid package dhtmlxGrid\04_dataprocessor\