Hi
I need some help please... I used the B4A source to try and port it over to b4i to access the database.
This is my select.php code sitting on the server with permissions set...
Then I run this method within my code to return a result of a select statement..
And in my job done code...
However in all my instances I get a 403 error all the time.. How can I solve this? I understand it can be my server settings perhaps, I'm not sure. Can someone advise please?
I need some help please... I used the B4A source to try and port it over to b4i to access the database.
This is my select.php code sitting on the server with permissions set...
B4X:
<?
$databasehost = "xxx";
$databasename = "xxx";
$databaseusername ="xxxx";
$databasepassword = "xxx";
$con = mysql_connect($databasehost,$databaseusername,$databasepassword) or die(mysql_error());
mysql_select_db($databasename) or die(mysql_error());
mysql_query("SET CHARACTER SET utf8");
$query = file_get_contents("php://input");
$sth = mysql_query($query);
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);
}
?>
Then I run this method within my code to return a result of a select statement..
B4X:
Sub ExecuteRemoteQuery(Query As String, JobName As String)
Dim job As HttpJob
job.Initialize(JobName, Me)
job.PostString("http://...select.php", Query)
End Sub
And in my job done code...
B4X:
Sub JobDone (Job As HttpJob)
b4iMash.HideProgress
If Job.Success = True Then
Select Job.JobName
Case "CheckUser"
' check if user exists using email address
Log(Job.GetString)
Dim lUsers As List = b4iMash.Json2List(Job.GetString)
Dim eUser As Map
Dim uTot As Int
Dim uCnt As Int
uTot = lUsers.Size - 1
For uCnt = 0 To uTot
' get the user map
eUser = lUsers.Get(uCnt)
Log(eUser)
'Dim tl As TwoLines
'tl.First = m.Get("id")
'tl.Second = m.Get("name")
'ListView1.AddTwoLines2(tl.First, tl.Second, tl)
Next
End Select
Else
Msgbox(Job.ErrorMessage, "Error")
End If
Job.Release
End Sub
However in all my instances I get a 403 error all the time.. How can I solve this? I understand it can be my server settings perhaps, I'm not sure. Can someone advise please?