I want to ask how to pass data from php
to textview
in android with json
. I already create this php
file to retrieve data from my db, but the thing is I don't know how to pass it to android with json
. I have read many tutorial, but it doesn't seem to fix my problem since they all using httpclient
and httppost
which is already deprecated. Can u please help me?
Here is my php file
<? php
mysql_connect("localhost","root","");
mysql_select_db("mydatabase");
$query = "SELECT * FROM tbl_user";
$result = mysql_query($query);
while($row = mysql_fetch_assoc($result))
{
array_push($result,
array('Name'=>$record[0],
'Address'=>$record[1],
'address'=>$record[2]
));
}
echo json_encode(array("result"=>$result));
?>