Hi DonManfred,
How I said, the code is basically the samples found here at this forum.
When the query edits only 1 field, it works fine (for example: "UPDATE Itens SET valor = '100,00' WHERE Itm = 1000").
But, if it edits multiple fields, not works: (for example: "UPDATE Itens SET item = "Test', valor = '100,00' WHERE Itm = 1000").
The code follows:
Web Service:
<?php
$databasehost = "localhost";
$databasename = "myDB";
$databaseusername ="myUser";
$databasepassword = "123456";
$con = mysql_connect($databasehost,$databaseusername,$databasepassword) or die(mysql_error());
mysql_select_db($databasename) or die(mysql_error());
mysql_query("SET CHARACTER SET utf8"); // This is the line I added
$queryin = file_get_contents("php://input");
//$query = $_GET["query"]; forget this one, was used just for tests..No need to be here
$sth = mysql_query($queryin);
if (mysql_errno()) {
header("HTTP/1.1 500 Internal Server Error");
echo $query.'\n';
echo mysql_error();
}
else
{
$rows = array();
while($r = mysql_fetch_assoc($sth)) {
$rows[] = $r;
}
print json_encode($rows);
}
?>
And the B4A, the code that execute the query:
Sub ExecuteRemoteQuery(Query As String, JobName As String)
Dim job As HttpJob
ProgressDialogShow("Obtendo dados...")
job.Initialize(JobName, Me)
job.PostString(sDBSvrHost, "UPDATE itens SET item = '" & etItem.Text.Trim & "', valor = '" & etValor.Text.Trim & "', descr = '" & etDescr.Text.Trim & "' WHERE itemid = " & sItID)
End Sub
BTW: the web service returns this message:
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>403 Forbidden</title>
</head><body>
<h1>Forbidden</h1>
<p>You don't have permission to access /wservc.php
on this server.<br />
</p>
<p>Additionally, a 403 Forbidden
error was encountered while trying to use an ErrorDocument to handle the request.</p>
</body></html>
But I already re-checked the privileges of the user, and other web server settings. So, all other operations work 100%, only the multiple fields update query still not working.