mysql.php code:
<?php
$databasehost = "localhost";
$databasename = "asc202304";
$databaseusername ="root";
$databasepassword = "xxxxxxxx";
$con = mysqli_connect($databasehost,$databaseusername,$databasepassword, $databasename) or die(mysqli_error($con));
mysqli_set_charset ($con , "utf8");
$query = file_get_contents("php://input");
$sth = mysqli_query($con, "SET SESSION GROUP_CONCAT_MAX_LEN =1000000");
//you can set the query by adding the query parameter For ex: http://127.0.0.1/test.aspx?query=select * from table1
$sth = mysqli_query($con, $query);
if (mysqli_errno($con)) {
header("HTTP/1.1 500 Internal Server Error");
echo $query.'\n';
echo mysqli_error($con);
}
else
{
$rows = array();
while($r = mysqli_fetch_assoc($sth)) {
$rows[] = $r;
}
$res = json_encode($rows);
echo $res;
mysqli_free_result($sth);
}
mysqli_close($con);
?>
Hai All Please Help
link : https://www.b4x.com/android/forum/threads/connect-android-to-mysql-database-tutorial.8339/#content
i cannot get result of query, so i test from browser like this : http://localhost/mysql.php?query=select * from tbltrans
and result is
why ? variable query is empty.
i'm not familiar with php.
please help