Forgive me for asking this, But im new in android development. So I'm trying to put the TextView
value into my URL, that in my webservice(PHP) I have $_GET to test my query and show only the desired match value of field name "WHERE CODE_ID = .$sample."
CameraTestActivity.class
if (!scanText.getText().toString().matches("")){
//set the scan text from bar code label
scanText.setText(sym.getData());
//if Text scan the Content Automatic go to another Activity and pass the scan text from Main Activity
Intent i = new Intent(CameraTestActivity.this, MainActivity2.class);
i.putExtra("code_id", content);
startActivity(i);
finish();
}
MainActivity2.class
//trying to put the TextValue of scanText into tvView
tvView = (TextView)findViewById(R.id.textView9);
tvView.setText(getIntent().getExtras().getString("code_id"));
String ServerURL = ("https://asec-domain.000webhostapp.com/select.php?code_id=" + tvView);
getAll.php
if (isset($_GET['code_id']))
{
$id = $_GET['code_id'];
}
// Create connection
$conn = new mysqli($HOST='localhost', $USER='id4400742_asec_domain', $PASS='asec@l0cal', $DB='id4400742_tbl_data');
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
$sql = "SELECT * FROM tbl_ComputerDetails WHERE CODE_ID= id ";
$result = $conn->query($sql);
if ($result->num_rows >0) {
while($row[] = $result->fetch_assoc()) {
$tem = $row;
$json = json_encode($tem);
}
echo $json;
}
else
{
echo "No Results Found.";
}
$conn->close();
?>