Hi all
I have a mysql database linked by php, this is the config.php file:
this if the php file:
and this is my B4A code:
the encoding of the database and all the tables and fields is utf-general-ci but question marks appeared in places of the Arabic letters in res string. where is the problem?
thanks.
I have a mysql database linked by php, this is the config.php file:
B4X:
<?php
$username="username";
$password="password";
$host="localhost";
$database="database";
$con = mysqli_connect($host,$username,$password, $database) or die(mysqli_error($con));
$mysqli = new mysqli("localhost", $username, $password, $database);
$mysqli->set_charset("utf8mb4");
?>
this if the php file:
B4X:
<?php
header("Content-type: application/json; charset=utf-8");
include ('../includes/config.php');
$q = "SELECT * FROM GeneralInfo";
$result = $con->query($q);
$rows = array();
while($r = mysqli_fetch_assoc($result)) {
$rows[] = $r;
}
if($rows ==null)
print(json_encode(''));
else
print(json_encode($rows));
?>
and this is my B4A code:
B4X:
Dim job2 As HttpJob
job2.Initialize("", Me)
job2.Download("https://mywebsite/GeneralInfo/getinfo.php" )
Wait For (job2) JobDone(job2 As HttpJob)
Dim res As String
res = job2.GetString
res = "[" & res & "]"
Log(res)
thanks.