Hi all, my scripts don’t update! The server response is not an xml document, but an error 404: in DataProcessor Debug I read :
******************************************************************
row 1-AD marked [updated,valid]
Initiating data sending for 1-AD
Sending in one-by-one mode, current ID = 1-AD
Server url: update_perventivi.php parameters
gr_id=1-AD
c0=1
c1=AD
c2=Ric
c3=2009-07-01%2013%3A05%3A00
c4=%3Cb%3EPREVENTIVO%20DI%20TEST-Riccardo%3C%2Fb%3E
c5=1
c6=9999
c7=%3Cb%3Etest%20riccardo%3C%2Fb%3E
!nativeeditor_status=updated
Server response received details
a:link {font:8pt/11pt verdana; color:FF0000} a:visited {font:8pt/11pt verdana; color:#4e4e4e} Impossibile trovare la pagina
Impossibile trovare la pagina |
� possibile che la pagina che si sta cercando sia stata rimossa, rinominata oppure che sia temporaneamente non disponibile. |
Procedere nel seguente modo:
HTTP 404 - File non trovato |
Not an XML, probably incorrect content type specified ( must be text/xml ), or some text output was started before XML data
******************************************************************
My code:
*****************************************************************
update_preventivi.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);
//db connection settings
mysql_pconnect(“localhost”, “gestionale”, “opera”);
mysql_select_db (“gestionale”);
function update_row(){
$sql = “UPDATE preventivi SET note=’”.$_GET[“c4”].”’, evasioneInterna=’".$_GET[“c5”]."’
WHERE ID=’".$_GET[“c0”]."’ AND revisione=’".$_GET[“c1”]."’;";
$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="UTF-8"?>’);
$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 “”;
?>
******************************************************************
getGridRecords.php:
<?php
error_reporting(E_ALL ^ E_NOTICE);
header(“Content-type:text/xml”);
print("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
//define variables from incoming values
if(isset($_GET[“posStart”])) $posStart = $_GET[‘posStart’];
else $posStart = 0;
if(isset($_GET[“count”])) $count = $_GET[‘count’];
else $count = 10;
mysql_pconnect(“localhost”, “gestionale”, “opera”);
mysql_select_db (“gestionale”);
//create query to products table
$sql = “SELECT ID, revisione,dataInserimento,dataRevisione,operatore,note,evasioneInterna,ID_Cliente,ragioneSociale,statoPreventivo FROM preventivi”;
//query to products table
if(isset($_GET[“filter”]))
$sql.=" WHERE operatore like ‘%".$_GET[“filter”]."%’";
//$sql.= " GROUP BY ID “;
//order by
$columns = array(“ID”,“revisione”,“operatore”,“dataInserimento”,“note”,“evasioneInterna”,“ID_Cliente”,“ragioneSociale”);
if(isset($_GET[“orderby”]))
{
if($_GET[“direct”]==‘des’) $direct = “DESC”;
else $direct = “ASC”;
$sql.=” ORDER BY “.$columns[$_GET[“orderby”]].” ".$direct;
}
//if this is the first query - get total number of records in the query result
if($posStart==0){
$sqlCount = "Select count() as cnt from ($sql) as tbl";
$resCount = mysql_query ($sqlCount);
$rowCount=mysql_fetch_array($resCount);
$totalCount = $rowCount[“cnt”];
}
//add limits to query to get only rows necessary for the output
$sql.= " LIMIT “.$posStart.”,".$count;
//query database to retrieve necessary block of data
$res = mysql_query ($sql);
//output data in XML format
print("");
while($row=mysql_fetch_array($res))
{
if($res)
{
if($row[“dataRevisione”]) $data=$row[“dataRevisione”];
else $data=$row[“dataInserimento”];
print("<row id=’".$row[‘ID’]."-".$row[‘revisione’]."’>");
print(""); print(htmlspecialchars($row[“ID”])); print("");
print(""); print(htmlspecialchars($row[“revisione”])); print("");
print(""); print(substr($row[“operatore”],0,3)); print("");
print(""); print(htmlspecialchars($data)); print("");
print(""); print(htmlspecialchars($row[“note”])); print("");
print(""); print(htmlspecialchars($row[“evasioneInterna”])); print("");
print(""); print(htmlspecialchars($row[“ID_Cliente”])); print("");
print(""); print(htmlspecialchars($row[“ragioneSociale”])); print("");
print(""); print(htmlspecialchars($row[“PDF”])); print("");
print("");
}
else
{
//error occurs
echo mysql_errno().": “.mysql_error().” at “.LINE.” line in “.FILE.” file
";
}
}
print("");
?>
*****************************************************************
Thanks in advance!!
FiFFiO