title: Android: Populate listview with php and mysql database with a JOIN query
body: <p>Hello guys i want to populate a listview with the database items. But using any JOIN(inner, left or right) to merge my two tables in order to view the selected items in table 1 and table 2.</p>
  
  <p>Here is my PHP Code:</p>
  
  <pre><code>&lt;?php   
  $link = mysql_pconnect("localhost", "root", "") or die("Could not connect");
  mysql_select_db("dbmobile_class_record") or die("Could not select database");
  
  $arr = array();
  
  $rs = mysql_query("SELECT tb_student.stud_id, tb_student.stud_name, tb_attendance.remark FROM tb_student LEFT JOIN tb_attendance ON tb_student.stud_id=tb_attendance.stud_id");
  
  while($obj = mysql_fetch_object($rs)) {
  $arr[] = $obj;
  }
  echo ''.json_encode($arr).'';
  ?&gt;
  </code></pre>
  
  <p>This is the JSON:</p>
  
  <pre><code>[
  
      {
          "stud_id":"20131299",
          "stud_name":"Angelo Velayo",
          "remark":"Present"
      },
      {
          "stud_id":"20131296",
          "stud_name":"Jeffrey Oliveras",
          "remark":"Present"
      }
  
  ]
  </code></pre>
  
  <p>as you can see the query works and it merge the two tables.</p>
  
  <p>and this is my Java file:</p>
  
  <pre><code>public class ViewAttendance extends AppCompatActivity {
      private static final String TAG = ViewAttendance.class.getSimpleName();
      private static final String url = "http://10.0.2.2/MobileClassRecord/getStudentAttendance.php";
      private ProgressDialog pDialog;
      private List&lt;StudentAttendanceList&gt; studAttList = new ArrayList&lt;&gt;();
      private ListView mylistView;
      private CustomStudAttendanceListAdapter adapter;
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_view_attendance);
          getSupportActionBar().setDisplayHomeAsUpEnabled(true);
  
          mylistView = (ListView) findViewById(R.id.list);
          adapter = new CustomStudAttendanceListAdapter(this, studAttList);
          mylistView.setAdapter(adapter);
          mylistView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
              @Override
              public void onItemClick(AdapterView&lt;?&gt; parent, View view, int position, long id) {
  
              }
          });
  
          pDialog = new ProgressDialog(this);
          pDialog.setMessage("Loading...");
          pDialog.show();
  
          JsonArrayRequest request = new JsonArrayRequest(url, new Response.Listener&lt;JSONArray&gt;() {
              @Override
              public void onResponse(JSONArray response) {
                  Log.d(TAG, response.toString());
                  hidePDialog();
  
                  for (int i = 0; i &lt; response.length(); i++) {
                      try {
                          JSONObject jsonObject = response.getJSONObject(i);
                          StudentAttendanceList sAttList = new StudentAttendanceList();
                          sAttList.setId(jsonObject.getString("stud_id"));
                          sAttList.setName(jsonObject.getString("student_name"));
                          sAttList.setRemark(jsonObject.getString("remark"));
  
                          studAttList.add(sAttList);
                      } catch (JSONException e) {
                          e.printStackTrace();
                      }
                  }
                  adapter.notifyDataSetChanged();
              }
          }, new Response.ErrorListener() {
              @Override
              public void onErrorResponse(VolleyError volleyError) {
                  VolleyLog.d(TAG, "Error: " + volleyError.getMessage());
                  hidePDialog();
              }
          });
          AppController.getInstance().addToRequestQueue(request);
      }
  
      @Override
      protected void onDestroy() {
          super.onDestroy();
          hidePDialog();
      }
  
      private void hidePDialog() {
          if (pDialog != null) {
              pDialog.dismiss();
              pDialog = null;
          }
      }
  </code></pre>
  
  <p>and this is the <a href="http://www.androidhive.info/2014/07/android-custom-listview-with-image-and-text-using-volley/" rel="nofollow">tutorial</a> that i have followed in populating the list view</p>
  
  <p>My Problem: The items is not showing in the listview</p>