I want to pass the variable `q` from java to php. 

```
String q = "select author from books where 1";
try{
                HttpClient httpClient = new DefaultHttpClient();
                HttpPost httpPost = new HttpPost("http://www2.XXXX./XXXX/X.php?qy="+q);
                //"http://10.0.2.2/tut.php", http://www.XXXX/XXXX/tut.php
                HttpResponse response = httpClient.execute(httpPost);
                HttpEntity entity = response.getEntity();
                is = entity.getContent();
            }catch(Exception e){
                e.printStackTrace(); 
                System.out.println("Exception 1 caught");
            }

```

However, the php file cannot get the value from java(php connected to mysql correctly).

php coding:

```
<?php
$con=mysql_connect("XXX.XXX","XX","XXX");
mysql_select_db("XX",$con);

$st = $_GET['qy'];
$r = mysql_query("$st");

while($row=mysql_fetch_array($r))
{
$out[]=$row;
}

print(json_encode($out));
mysql_close($con);
?>

```

I found that if I just pass the table name to php, it works. But if the passing variable become longer, it went to caught one. How can I fix this? How about passing more than one variable to php (i.e. `mysql_query("select $_GET['col'] from $_GET['table'] where $_GET['condition']");`)?