GetTransactions is unable to work. it returns [] when i checked the log. Am i doing anything wrong in this "GetTransactions"
B4X:
Dim DownloanTransactions As HttpJob
DownloanTransactions.Initialize("DownT", Me)
DownloanTransactions.Download2(Server, Array As String ("action", "GetTransactions","memberID",MemberID,"lasttrans",LastTransID))
B4X:
$action = $_GET["action"];
switch ($action)
{
case "CountPersons":
$q = mysqli_query($con,"SELECT * FROM DepositTransactions WHERE MemberID=40001762");
$count = mysqli_num_rows($q);
print json_encode($count);
mysqli_close($con);
break;
Case "GetTransactions":
$memberid = $_GET["memberid"];
$lasttrans = $_GET["lasttrans"];
$q = mysqli_query($con,"SELECT * FROM DepositTransactions WHERE MemberID=$memberid AND TranNo>$lasttrans");
$rows = array();
while($r = mysqli_fetch_assoc($q))
{
$rows[] = $r;
}
print json_encode($rows);
mysqli_close($con);
break;
I posted a really good PHP 7 Compatible Class and a sample on how to work with this Class. For sure it is not a complete use but it shows the main usage.
Correctly used you dont need to take care about escaping vars. The class do all this.
BUT you are now using simple mysqli methods. So you need to get familar will all of them.
There are a lot of documentation on the php site about all of them. Including userhints. Start reading there.
I guess you should google for some tutorials on how to use the mysqli methods correctly.
I posted a really good PHP 7 Compatible Class and a sample on how to work with this Class. For sure it is not a complete use but it shows the main usage.
Correctly used you dont need to take care about escaping vars. The class do all this.
BUT you are now using simple mysqli methods. So you need to get familar will all of them.
There are a lot of documentation on the php site about all of them. Including userhints. Start reading there.
I guess you should google for some tutorials on how to use the mysqli methods correctly.
Thanks@DonManfred. When I use the class you gave me the connection to the server fails. Am still learning from you class and picking one or two from there. Will do more reading as recomemded.