title: selecting mysql data inside an array with PDO fetchAll
body: <p>I'm trying to get a certain data from mysql with fetchAll.</p>
  
  <p>I currently have this:</p>
  
  <pre><code>$sql1= $dbh-&gt;query("SELECT * FROM information");
  $comments= $dbh-&gt;prepare("SELECT * FROM comments WHERE idinformation= ?");
  if($retail){
  while($row = $retail -&gt; fetch(PDO::FETCH_ASSOC)){
    $comments-&gt;execute(array($row['idproducts']));
    $json['data'][] = array(
       'id'=&gt;$row['idproducts'],
       "headline"=&gt;$row['headline'],
       'price'=&gt; array ("full_price" =&gt; $row['full_price']),
       'description'=&gt;$row['description'],
       "comments" =&gt; $comments-&gt;fetchAll(PDO::FETCH_ASSOC)
  );
  }
  $json_encode = json_encode($json);
  $obj = json_decode($json_encode,true);  
  }
  </code></pre>
  
  <p>My comments is output all the columns in my database. What if I only want comments,time,id,etc... how would I distinguish this in this syntax?</p>
  
  <p>Thanks in advance!</p>