I am getting the 'Query was empty' error in the web page. Of course the error in B4A that follows is: Lastexception, Runtime exception, JSON array expected in this line: lstItems = parser.NextArray
I am not sure if the problem is in the B4A code or in the following php script. My knowledge in php is almost non existent and JSON means nothing to me but a mispelled first name. This is my first exposure to php and MySQL together. I read a ton of information in the forums. I appreciate the help from someone with patience.
BELOW is the php CODE:
<?
//code to connect to the remote database web site MySQL database
$databasehost = "production.db.925091.hostedresource.com";
$databasename = "production";
$databaseusername ="production";
$databasepassword = xtsytehnZ%";
$con = mysql_connect($databasehost,$databaseusername,$databasepassword) or die(mysql_error());
mysql_select_db($databasename) or die(mysql_error());
$query = $_GET["query"];
$sth = mysql_query($query);
if (mysql_errno()) {
echo mysql_error();
}
else
{
$rows = array();
while($r = mysql_fetch_assoc($sth)) {
$rows[] = $r;
}
print json_encode($rows);
}
?>
I am not sure if the problem is in the B4A code or in the following php script. My knowledge in php is almost non existent and JSON means nothing to me but a mispelled first name. This is my first exposure to php and MySQL together. I read a ton of information in the forums. I appreciate the help from someone with patience.
BELOW is the php CODE:
<?
//code to connect to the remote database web site MySQL database
$databasehost = "production.db.925091.hostedresource.com";
$databasename = "production";
$databaseusername ="production";
$databasepassword = xtsytehnZ%";
$con = mysql_connect($databasehost,$databaseusername,$databasepassword) or die(mysql_error());
mysql_select_db($databasename) or die(mysql_error());
$query = $_GET["query"];
$sth = mysql_query($query);
if (mysql_errno()) {
echo mysql_error();
}
else
{
$rows = array();
while($r = mysql_fetch_assoc($sth)) {
$rows[] = $r;
}
print json_encode($rows);
}
?>