I can get the data from database , but don’t update data to database, I used myDataProcessor.enableDebug, it show the error is :
xml status : correct
server response:
Parse error:syntax error, unexpected T_VARIABLE in php\update(live).php on line 59
when I checked the line 59, it hasn’t some error, because this is the insert sql code,
$sql.= “Values(’”.$_GET[“description”]."’,".$_GET[“qty”].",’"$_GET[“type”]."’,".$_GET[“cbm”].",".$_GET[“width”].",’".$_SESSION[“id”]."’)";
please help,
thank you very much
the following code my my testing code.
html code
php/get(live).php code
<?php
session_start();
if(!isset($_SESSION[“id”]))
$_SESSION[“id”] = microtime();
require_once("…/…/common/config.php");
$link = mysql_pconnect($mysql_host, $mysql_user, $mysql_pasw);
$db = mysql_select_db ($mysql_db);
//XML HEADER
//include XML Header (as response will be in xml format)
if ( stristr($_SERVER[“HTTP_ACCEPT”],“application/xhtml+xml”) ) {
header(“Content-type: application/xhtml+xml”);
//header(“Content-type: text/xml”);
}
echo("<?xml version=\"1.0\" encoding=\"iso-8859-1\"?>\n");
//cbm
if($_GET[“cbm”]==""){
$_GET[“cbm”] = “0”;
}
if(isset($_GET["!nativeeditor_status"]) && trim($_GET["!nativeeditor_status"])==“inserted”){
//INSERT
$sql = “Insert into test(description,qty,type,cbm,width,GUID) “;
$sql.= “Values(’”.$_GET[“description”].”’,”.$_GET[“qty”].",’"$_GET[“type”]."’,".$_GET[“cbm”].",".$_GET[“width”].",’".$_SESSION[“id”]."’)";
$res = mysql_query($sql);
//set value to use in response
$newId = mysql_insert_id();
$action = “insert”;
}else if(isset($_GET["!nativeeditor_status"]) && $_GET["!nativeeditor_status"]==“deleted”){
//DELETE
$d_sql = “Delete from test where id=”.$_GET[“gr_id”]." and GUID=’".$_SESSION[“id”]."’";
$resDel = mysql_query($d_sql);
//set values to include in response
$newId = $_GET[“gr_id”];
$action = “delete”;
}else{
//UPDATE
//update row
$sql = " Update test set description=’".$_GET[“description”]."’,qty =".$_GET[“qty”].",type = ‘".$_GET[“type”]."’,cbm=".$_GET[“cbm”].",width =".$_GET[“width”]." where book_id=".$_GET[“gr_id”]." and GUID=’".$_SESSION[“id”]."’";
//$sql = “Update test set description=”.$_GET[“description”].",qty=’".$_GET[“qty”]."’,type=’".$_GET[“type”]."’,cbm=".$_GET[“cbm”].",width=’".$_GET[“width”]."’,pub_date=".$_GET[“pubdate”]." where book_id=".$_GET[“gr_id”]." and GUID=’".$_SESSION[“id”]."’";
$res = mysql_query($sql);
//set values to include in response
$newId = $_GET[“gr_id”];
$action = “update”;
}
?>
<?php
echo “$newid = “.$newId;
if($newId!=0){
print(””);
}else{
print(“SQL query error”);
}
?>
As far as I can see you had miss a dot in next place
"Values(’".$_GET[“description”]."’,".$_GET[“qty”].",’">>.<<$_GET[“type”]."’,".$_GET[“cbm”].",".$_GET[“width”].",’".$_SESSION[“id”]."’)"