Dears (Hi Erel),
I have been using, for more than 2 years the Tutorial by Erel here to connect my apps to remote mysql server, without any issues.
The below PHP code "
However I have decided to migrate the server to a new remote server (website hosting) :
1. No issue when posting "SELECT" statement
2. Issue when posting "INSERT" or "UPDATE" statement. The "JobDone(Job As HttpJob)" will return Job.ErrorMessage as "" (no string message).
After INSERT or UPDATE statement, I checked that the record has been inserted or updated in mySQL server, however the return message is the issue here.
This issue didn't occurs while using the old server. In the old server it will return as Job.Success = True
Is there something at the server setting that I need to change of the PHP code itself?
In Erel's tutorial he mentioned that "I've restricted the database user to SELECT queries (in MySQL configuration)"
Could it be the reason? If so where exactly do I need to change?
Thank you for your feedback.
I have been using, for more than 2 years the Tutorial by Erel here to connect my apps to remote mysql server, without any issues.
The below PHP code "
B4X:
<?php
$databasehost = "localhost";
$databasename = "xxxx";
$databaseusername ="xxxx";
$databasepassword = "xxxx";
$con = mysqli_connect($databasehost,$databaseusername,$databasepassword, $databasename) or die(mysqli_error($con));
mysqli_set_charset ($con , "utf8");
$query = file_get_contents("php://input");
$sth = mysqli_query($con, $query);
if (mysqli_errno($con)) {
header("HTTP/1.1 500 Internal Server Error");
echo $query.'\n';
echo mysqli_error($con);
}
else
{
$rows = array();
while($r = mysqli_fetch_assoc($sth)) {
$rows[] = $r;
}
$res = json_encode($rows);
echo $res;
mysqli_free_result($sth);
}
mysqli_close($con);
?>
However I have decided to migrate the server to a new remote server (website hosting) :
1. No issue when posting "SELECT" statement
2. Issue when posting "INSERT" or "UPDATE" statement. The "JobDone(Job As HttpJob)" will return Job.ErrorMessage as "" (no string message).
After INSERT or UPDATE statement, I checked that the record has been inserted or updated in mySQL server, however the return message is the issue here.
This issue didn't occurs while using the old server. In the old server it will return as Job.Success = True
Is there something at the server setting that I need to change of the PHP code itself?
In Erel's tutorial he mentioned that "I've restricted the database user to SELECT queries (in MySQL configuration)"
Could it be the reason? If so where exactly do I need to change?
Thank you for your feedback.