我想从数据库中获取结果作为数组。我有一张“commande”桌子,里面有存货。我想以数组的形式获取库存。像这样的东西:array[0],array[],array[2]
这是我的表命令的结构(idfichecmd idproduit idclt qte datecmd)
这是我的代码:
String response = null;
String res = "";
//the year data to send
ArrayList<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>();
nameValuePairs.add(new BasicNameValuePair("",));
try {
Log.i("","<<<<<<<<<<<<<<<<<<<<TRY");
response = CustomHttpClient.executeHttpPost("http://0.0.0.0/GetCmdDetails.php",nameValuePairs);
res=response.toString();
// res = res.trim();
//res= res.replaceAll("\\s+","");
//error.setText(res);
} catch (Exception e) {
Log.i("","<<<<<<<<<<<<<<<<<<<<Catch");
}
//parse json data
try{
JSONArray jArray = new JSONArray(res);
//-----------------------------------------
//nom= new String[jArray.length()];
//prenom= new String[jArray.length()];
//----------------------------------------
for (int i=0;i<jArray.length();i++) {
JSONObject json_data = jArray.getJSONObject(i)