Guest User

Untitled

a guest
Jan 31st, 2018
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.36 KB | None | 0 0
  1. //CameraTestActivity.class
  2. if (!scanText.getText().toString().matches("")){
  3.  
  4. //set the scan text from bar code label
  5.  
  6. scanText.setText(sym.getData());
  7.  
  8. //if Text scan the Content Automatic go to another Activity and pass the scan text from Main Activity
  9.  
  10. Intent i = new Intent(CameraTestActivity.this, MainActivity2.class);
  11. i.putExtra("code_id", content);
  12. startActivity(i);
  13. finish();
  14.  
  15. }
  16.  
  17. //MainActivity2.class
  18.  
  19. //trying to put the TextValue of scanText into tvView
  20. tvView = (TextView)findViewById(R.id.textView9);
  21. tvView.setText(getIntent().getExtras().getString("code_id"));
  22.  
  23. String ServerURL = ("https://asec-domain.000webhostapp.com/select.php?code_id=" + tvView);
  24.  
  25.  
  26. //getAll.php
  27. <?php
  28.  
  29. if (isset($_GET['code_id']))
  30. {
  31. $id = $_GET['code_id'];
  32. }
  33.  
  34. // Create connection
  35.  
  36. $conn = new mysqli($HOST='localhost', $USER='id4400742_asec_domain', $PASS='asec@l0cal', $DB='id4400742_tbl_data');
  37.  
  38. if ($conn->connect_error) {
  39.  
  40. die("Connection failed: " . $conn->connect_error);
  41. }
  42.  
  43. $sql = "SELECT * FROM tbl_ComputerDetails WHERE CODE_ID= id ";
  44.  
  45. $result = $conn->query($sql);
  46.  
  47. if ($result->num_rows >0) {
  48.  
  49. while($row[] = $result->fetch_assoc()) {
  50.  
  51. $tem = $row;
  52.  
  53. $json = json_encode($tem);
  54.  
  55. }
  56.  
  57. echo $json;
  58.  
  59. }
  60.  
  61. else
  62. {
  63.  
  64. echo "No Results Found.";
  65. }
  66. $conn->close();
  67. ?>
Add Comment
Please, Sign In to add comment