Androi app reading a mysql databace via php servises
<p>I have an application reading a mysql database as shown below</p>

<pre><code>&lt;?php
mysql_connect("host","username","password");
mysql_select_db("Cars");

$q=mysql_query("SELECT * FROM car WHERE model_year&gt;'".$_REQUEST['year']."'");
while($e=mysql_fetch_assoc($q))
        $output[]=$e;

print(json_encode($output));

mysql_close();
?&gt;
</code></pre>

<p>and the java android code that send the request and read the data is as shown below</p>

<pre><code>String result = "";
//the year data to send
ArrayList&lt;NameValuePair&gt; nameValuePairs = new ArrayList&lt;NameValuePair&gt;();
nameValuePairs.add(new BasicNameValuePair("year","1998"));

//http post
try{
        HttpClient httpclient = new DefaultHttpClient();
        HttpPost httppost = new HttpPost("http://example.com/getmodelsafter.php");
        httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs));
        HttpResponse response = httpclient.execute(httppost);
        HttpEntity entity = response.getEntity();
        InputStream is = entity.getContent();
}catch(Exception e){
        Log.e("log_tag", "Error in http connection "+e.toString());
}
</code></pre>

<p>and catches the data after that.</p>

<p>How should be my java code in case I wanted to pass tow different values in my database lets say  </p>

<pre><code>&lt;?php
mysql_connect("host","username","password");
mysql_select_db("Cars");

$q=mysql_query("SELECT * FROM car WHERE model_year&gt;'".$_REQUEST['year']."'
 and color="'".$_REQUEST['color']."'");
while($e=mysql_fetch_assoc($q))
        $output[]=$e;

print(json_encode($output));

mysql_close();
?&gt;
</code></pre>
