Linked Questions

Popular Questions

I am trying implement a search activity which gets data from a mysql table based on a search.

I want to write a PHP script to use the string entered into the EditText and get the adjacent cell.

For example, Imagine there are two columns of the mysql table: Firstname and surname; I would like to be able to get the surname by searching the Firstname (Entering the Firstname into the EditText. I know this may require a SELECT Surname FROM Names WHERE ... query but how do I indicate the variable from my Java class?

The PHP script so Far:

<?php
mysql_connect("localhost","root","");
mysql_select_db("androidapp");
$sql=mysql_query("SELECT surname WHERE $get'fname'");
while($row=mysql_fetch_assoc($sql)) $output[]=$row;
print(json_encode($output));
mysql_close();
?>

Also, is the HttpGet method appropriate or HttPost method to do this, the result should display the surname in a TextView

Related Questions