I've been trying to develop a B4A app that draws data from and stores data to a MySQL database using a parameteratized PHP file.
The first segement in my PHP file accepts and activity parameter and an ID parameter and returns dat through a SQL select statement. Below is the code.
This works fine using a browser (See Attached jpg) but I haven't been able to tie it to my B4A program. I've tried both a req.InitializeGet statement and using the ExecuteRemoteQuery sub from Erol's example. In both cases something runs and I'm transferred to the httpResponseSuccess sub but get indication the the result is empty.
What do I need to do?
Thanks for your help.
Doug
The first segement in my PHP file accepts and activity parameter and an ID parameter and returns dat through a SQL select statement. Below is the code.
PHP:
<?php
$mysqlDatabaseName = "192.168.1.***";
$mysqlUsername = "root";
$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);
}
?>
This works fine using a browser (See Attached jpg) but I haven't been able to tie it to my B4A program. I've tried both a req.InitializeGet statement and using the ExecuteRemoteQuery sub from Erol's example. In both cases something runs and I'm transferred to the httpResponseSuccess sub but get indication the the result is empty.
What do I need to do?
Thanks for your help.
Doug