I'm trying to set up a B4A program that uses paramaterized PHP to request and receive information from a MySQL database.
This is my PHP code
I can access what I want through a browser
(See attached Thumbnail) but haven't been able to successfully call and retrieve through B4A. I've tried to use req.InitializeGet as well as the ExecuteRemoteQuery procedure from Erel's example. The program executes something and returns to the hc_ResponseSuccess sub but in both cases the result is empty.
How can I get this to work?
Thanks for your help.
Doug
This is my PHP code
PHP:
<?php
$mysqlDatabaseName = "192.168.1.***";
$mysqlUsername = "****";
$mysqlPassword = "****";
mysql_connect($mysqlDatabaseName, $mysqlUsername, $mysqlPassword) or die(mysql_error());
mysql_select_db("Inventory") or die(mysql_error());
if(isset($_GET['action'])){
$action = $_GET['action'];
}
if($action == "fetch"){
$fetchKey = $_GET['ID'];
$result = mysql_query("SELECT nomenclature,location, part_number, date_inventoried,quantity,location_detail FROM tblInventory WHERE tblInventory.key = '$fetchKey'" ) or die(mysql_error());
$rows = array();
while($row = mysql_fetch_array($result)){
$rows[] = $row ['nomenclature'];
$rows[] = $row ['location'];
$rows[] = $row ['part_number'];
$rows[] = $row ['date_inventoried'];
$rows[] = $row ['quantity'];
$rows[] = $row ['location_detail'];
}
echo json_encode($rows);
}
?>
I can access what I want through a browser
(See attached Thumbnail) but haven't been able to successfully call and retrieve through B4A. I've tried to use req.InitializeGet as well as the ExecuteRemoteQuery procedure from Erel's example. The program executes something and returns to the hc_ResponseSuccess sub but in both cases the result is empty.
How can I get this to work?
Thanks for your help.
Doug
Attachments
Last edited: