Hi,
i’m not able to understand why this code not update row:
MY INDEX PAGE:
D.B. Group Punch Management
MY GETDATA CODE:
<?php
//include db connection settings
//change this setting according to your environment
require_once("config.php");
//include XML Header (as response will be in xml format)
header("Content-type: text/xml");
//encoding may be different in your case
echo('<?xml version="1.0" encoding="iso-8859-1"?>‘);
//start output of data
echo ‘’;
//output data from DB as XML
$sql = “SELECT * FROM hs_hr_attendance”;
$res = mysql_query ($sql);
if($res){
while($row=mysql_fetch_array($res)){
//create xml tag for grid’s row
echo ("<row id=’“.$row[‘attendance_id’].”‘>“);
print(”“);
print(”“);
print(”“);
print(”“);
print(”“);
print(”“);
print(”“);
print(”“);
}
}else{
//error occurs
echo mysql_errno().”: “.mysql_error().” at “.LINE.” line in “.FILE.” file
";
}
echo ‘’;
?>
MY UPDATE CODE:
<?php
//code below is simplified - in real app you will want to have some kins session based autorization and input value checking
//include db connection settings
require_once("config.php");
function update_row(){
$sql = "UPDATE hs_hr_attendance SET " .
"attendance_id= '".$_GET["c0"]."',
employee_id= '".$_GET["c1"]."',
punchin_time='".$_GET["c2"]."',
punchout_time= '".$_GET["c3"]."',
in_note= '".$_GET["c4"]."',
out_note= '".$_GET["c5"]."',
status= '".$_GET["c6"]."',
WHERE attendance_id=".$_GET["c0"];
$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;
}
//output update results
echo “”;
echo “”;
echo “”;
?>
THE ERROR CODE IS:
Log:
Incorrect SID, row with such ID not exists in grid
Action: update SID: TID:
row unmarked [updated,valid]
row 2 marked [updated,valid]
Initiating data sending for 2
Initiating data sending for all rows
Sending all data at once
Server url: includes/php/update3.php?editing=true parameters
2_gr_id=2
2_c0=2
2_c1=5
2_c2=2009-01-22%2010%3A41%3A20
2_c3=Entrat
2_c4=2009-01-22%2018%3A40%3A21
2_c5=Uscita
2_c6=1
2!nativeeditor_status=updated
2!nativeeditor_status=
ids=2
Server response received details
<?xml version="1.0" encoding="iso-8859-1"?>
Incorrect SID, row with such ID not exists in grid
Action: update SID: TID:
row unmarked [updated,valid]
what is wrong?
Thank U