erasmusackon Member Licensed User Longtime User Jun 16, 2017 #1 This code is able to retrieve records from the server Code: $q = mysqli_query($con,"SELECT * FROM DepositTransactions"); $rows = array(); while($r = mysqli_fetch_assoc($q)) { $rows[] = $r; } echo json_encode($rows); mysqli_close($con); GetTransactions is unable to work. it returns [] when i checked the log. Am i doing anything wrong in this "GetTransactions" Code: Dim DownloanTransactions As HttpJob DownloanTransactions.Initialize("DownT", Me) DownloanTransactions.Download2(Server, Array As String ("action", "GetTransactions","memberID",MemberID,"lasttrans",LastTransID)) Code: $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; Last edited: Jun 16, 2017
This code is able to retrieve records from the server Code: $q = mysqli_query($con,"SELECT * FROM DepositTransactions"); $rows = array(); while($r = mysqli_fetch_assoc($q)) { $rows[] = $r; } echo json_encode($rows); mysqli_close($con); GetTransactions is unable to work. it returns [] when i checked the log. Am i doing anything wrong in this "GetTransactions" Code: Dim DownloanTransactions As HttpJob DownloanTransactions.Initialize("DownT", Me) DownloanTransactions.Download2(Server, Array As String ("action", "GetTransactions","memberID",MemberID,"lasttrans",LastTransID)) Code: $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;
erasmusackon Member Licensed User Longtime User Jun 16, 2017 #21 erasmusackon said: Learning for sure. But if you have the solution why not assist? Click to expand... Thanks. Working now Code: $q = mysqli_query($con,"SELECT * FROM DepositTransactions WHERE MemberID='".$memberid."' AND TranNo>'".$lasttrans."'" ); Upvote 0
erasmusackon said: Learning for sure. But if you have the solution why not assist? Click to expand... Thanks. Working now Code: $q = mysqli_query($con,"SELECT * FROM DepositTransactions WHERE MemberID='".$memberid."' AND TranNo>'".$lasttrans."'" );
R ronell Well-Known Member Licensed User Longtime User Jun 16, 2017 #22 erasmusackon said: Learning for sure. But if you have the solution why not assist? Click to expand... if we can or we know a way to solve the problem .. then we will Upvote 0
erasmusackon said: Learning for sure. But if you have the solution why not assist? Click to expand... if we can or we know a way to solve the problem .. then we will
tigrot Well-Known Member Licensed User Longtime User Jun 16, 2017 #23 How long in IT? I am since 1972 and learning everyday. Follow me : use print or echo to show variables on a normal browser. You won't regret! Upvote 0
How long in IT? I am since 1972 and learning everyday. Follow me : use print or echo to show variables on a normal browser. You won't regret!
erasmusackon Member Licensed User Longtime User Jun 16, 2017 #24 tigrot said: How long in IT? I am since 1972 and learning everyday. Follow me : use print or echo to show variables on a normal browser. You won't regret! Click to expand... Been a VB programmer all this while now trying PHP. Thank you for your advice. Upvote 0
tigrot said: How long in IT? I am since 1972 and learning everyday. Follow me : use print or echo to show variables on a normal browser. You won't regret! Click to expand... Been a VB programmer all this while now trying PHP. Thank you for your advice.
DonManfred Expert Licensed User Longtime User Jun 16, 2017 #25 erasmusackon said: why not assist? Click to expand... 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 cant help on this. I never used them. Upvote 0
erasmusackon said: why not assist? Click to expand... 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 cant help on this. I never used them.
erasmusackon Member Licensed User Longtime User Jun 16, 2017 #26 DonManfred said: 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 cant help on this. I never used them. Click to expand... 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. Upvote 0
DonManfred said: 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 cant help on this. I never used them. Click to expand... 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.