title: something wrong with PHP file preventing JSON data from parsing
body: <p>I developed search function when I type a value in the search bar a toast shows unable to parse, but there is nothing wrong with the android side, the problem lies in the PHP script. </p>
  
  <p>For example when I type "Art" this is the response from the server that doesn't show on the app only in the log: </p>
  
  <pre><code>s = {"result":[{"post_id":"390","post_title":"Cart","post_date":"2017-02-07 12:17:29"},{"post_id":"421","post_title":"Front End Developer - Digital Arts","post_date":"2017-02-07 12:18:04"},{"post_id":"431","post_title":"Art Director","post_date":"2017-02-07 12:18:19"}]}
  </code></pre>
  
  <p>This is my parser class: </p>
  
  <pre><code>public class Parser extends AsyncTask &lt;Void, Void,Integer&gt; {
  
      Context ctx;
      ListView listView;
      String data;
      ArrayList&lt;Skill&gt; skills = new ArrayList&lt;&gt;();
      ArrayAdapter adapter;
      ArrayList&lt;String&gt; titles = new ArrayList&lt;&gt;();
  
          public Parser(Context ctx, String data, ListView listView) {
              this.ctx = ctx;
              this.data=data;
              this.listView = listView;
          }
  
          @Override
          protected void onPreExecute() {
              super.onPreExecute();
          }
  
          @Override
          protected Integer doInBackground(Void... params) {
              return this.parse();
          }
  
          @Override
          protected void onPostExecute(Integer integer) {
              super.onPostExecute(integer);
              if (integer == 1) {
                  adapter = new ArrayAdapter(ctx, android.R.layout.simple_list_item_1, titles);
      //          CustomAdapter mAdapter = new CustomAdapter(ctx,skills);
                  adapter.notifyDataSetChanged();
                  listView.setAdapter(adapter);
                  listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
                      @Override
                      public void onItemClick(AdapterView&lt;?&gt; parent, View view, int position, long id) {
                          Intent toSkillActivity = new Intent(ctx,SkillActivity.class);
                          toSkillActivity.putExtra("skill",skills.get(position));
                          ctx.startActivity(toSkillActivity);
                      }});
              } else {
                  Toast.makeText(ctx, "Unable to Parse", Toast.LENGTH_LONG).show();
              }
          }
  
  
          private int parse() {
              try {
                  Log.d("Jou","data");
                  JSONArray ja = new JSONArray(data);
                  JSONObject jo = null;
                  titles.clear();
                  skills.clear();
                  for (int i = 0; i &lt; ja.length(); i++) {
                      jo = ja.getJSONObject(i);
                      String author = jo.getString("post_author");
                      String title = jo.getString("post_title");
                      //String content = jo.getString("post_content");/* authoer is better :P */
                      String date = jo.getString("post_date");
                      Skill skill = new Skill();
                      skill.setAuthor(author);
                      skill.setTitle(title);
                      //skill.setContent(content);
                      skill.setDate(date);
                      skills.add(skill);
                      titles.add(title);
                  }
                  return 1;
              } catch (JSONException e) {
                  Log.d("Jou", e.getMessage());
                  return 0;
              }
          }}
  </code></pre>
  
  <p>And here is PHP script: </p>
  
  <pre><code>&lt;?php
  $dbhost = 'localhost';
  $dbuser = '';
  $dbpass = '';
  $conn = mysqli_connect($dbhost, $dbuser, $dbpass) or die ("Unable to connect") ;
  if(! $conn )
  {
   echo 'Could not connect: ' . mysqli_error();
  }
  error_reporting(-1);
  ini_set('display_errors', 'On');
  mysqli_set_charset($conn, 'utf8');
  
  $search ="";
  if(isset($_REQUEST['query'] )){
     $search = $_REQUEST['query'];
  }
  if($search != ""){
  
     $sql = "SELECT post_author,post_title,post_date FROM `wp_posts` WHERE post_title LIKE '%".$search."%'";
  
      mysqli_select_db($conn,'');
  
  $query = mysqli_query($conn, $sql ) or die ("Error: ".mysqli_error($conn));;
  $result = array();
  while($row = mysqli_fetch_array($query, MYSQLI_ASSOC)){
  
  array_push($result,
      array('post_author'=&gt;$row['post_author'],
          'post_title'=&gt;$row['post_title'],
          'post_date'=&gt;$row['post_date']
      ));
  }
      echo json_encode(array("result"=&gt;$result));
  }else{
     echo 'No search field has been sent';
  }
  
  ?&gt;
  </code></pre>