title: explode and select each element from array
body: <p>I have a small task where I have a mysql table "shops".It contains a column "categories". Each field of categories contains diiferent values like "22,44,33,55,24,33,22"
  Now taking each value from that field, i need to get the value from a column "parent" in another table. (linking with ids) I am selecting the whole string, but i want to select each number. Please help me with this.</p>
  
  <pre><code>$db_selected = mysql_select_db("",$con);
  $sql = "SELECT categories from shops";
  $array = mysql_query($sql,$con);
  while($row=mysql_fetch_array($array)){
  foreach($row as $value){
      $result= explode(" ", $value);
      foreach($result as $newvalue){
      $query="SELECT parent FROM categories where categories.id=$newvalue&lt;br/&gt;";
      echo $query;
      }
      }
      }
  mysql_close($con);
  ?&gt;
  </code></pre>