i am really really new to android programming so pardon me for my total lack of knowledge
as of now, i have a sql database with 3 rows, "name", "contact" and "status"
I would like to retrieve both "status" whenever that matches the query of both a "name" and "contact". After getting the "status" query,I would like to convert the query into a TextView and display it in an android activity.
I still cant find out how to do so despite hours of searching.Thank you. My biggest problem is retrieving the "status" that matches "name" and "contact". Thank you for your help
This is my php script
<?php
$name = $_GET['name'];
$contact = $_GET['contact'];
require_once('Connect.php');
$sql = "SELECT * FROM database WHERE name=$name and contact = $contact";
$r = mysqli_query($con,$sql);
$row = mysqli_fetch_assoc($r);
$status =$row["status"];
echo "Your Current Status: ".$status;
mysqli_close($con);
EDIT:
My editted snippet is this, converted it to an array somehow and it kinda works.
$result = array();
$row = mysqli_fetch_array($r);
array_push($result,array(
"status"=>$row['status'],
));
//displaying in json format
echo json_encode(array('result'=>$result));
However, I have totally no idea how to use JSON to retrieve the status from the array and convert it to a String (and eventually TextView). Thank you,anyone for helping
</div>