title: Show result of MYSQL select query in two div according to column name, using a single select query
body: <p>I have a table with column names <code>id</code>, <code>name</code>, <code>category</code>, <code>title</code>,and <code>news</code>. Once select query executes I get all the required data from table but i need to split up this data into two div according to the category they belong. there are two different categories, say A and B.</p>
  
  <p>I need to show all the data with a column category name A in one div and same with category B. </p>
  
  <pre><code>$sql= "SELECT id, title ,news ,category FROM news  ";
  $query=mysql_query($sql, $ex)or die(mysql_error())  ;
  while($row=mysql_fetch_assoc($query)){ 
      $title=$row['title']; 
      if($row['category']==' Latest News'){
          echo $row['title'];
      }
  }
  </code></pre>
  
  <p>My code doesn't work. Any idea?</p>