java - send String[] b httprequest and get in php b $_GET -
i want send string[]
http request , values in php $_get
method.
total number of values in string[]
variable.
have tried far:
list<namevaluepair> params = new arraylist<namevaluepair>(); string[] dropdowns = {"1st item","2nd item","3rd item","4th item"}; (int = 0; < dropdowns.length; i++) { params.add(new basicnamevaluepair("pid", dropdowns[i])); }
in php want values , query based on them.
$pid = $_get['pid'];
and use them like:
$result = mysql_query("select *from apps pid[0] = $pid" , pid[1] = $pid" , ...);
but know way wrong. how can that?
this
$result = mysql_query("select *from apps pid[0] = $pid" , pid[1] = $pid" , ...);
is wrong , unsafe. (columns wrong syntax, sql injection, wrong quotation, wrong sql syntax,...)
must like
$result = mysql_query(" select * apps pid in(" . implode(',', mysql_real_escape_string($pid)) . ") ");
Comments
Post a Comment