enter image description hereIn android onclick I am passing a string to php using httpurlconnection and with that string I am trying to make a query that will select only those values which match the string?
<?php
require "init.php";
$transName = htmlspecialchars($_POST["transName"]);
$sql_query = "select * from trans_info where transName like '$transName';";
$res= mysqli_query($con,$sql_query);
$result= array();
while($row = mysqli_fetch_array($res))
{
array_push($result,
array('transName'=>$row[0],
'transGM'=>$row[1],
'transGR'=>$row[2],
'transAmt'=>$row[3]
));
}
echo json_encode(array("result"=>$result));
mysqli_close($con);
?>