title: PHP and Mysql : explode 2 strings into a three different fields on a table
body: <p>Hi there i've 2 fields in a mysql database with similar content:</p>
  
  <p><strong>Field 1</strong>: <code>a&gt;b&gt;c</code> <br />
  <strong>Field 2</strong>: <code>1&gt;2&gt;3</code> </p>
  
  <p>I wish to put them in different rows, exploded.</p>
  
  <p>Example:</p>
  
  <pre><code>-----------------
  |Field 1|Field 2|      
  |----------------
  |a      |1      |
  |b      |2      |
  |c      |3      |
  </code></pre>
  
  <p>Here a snippet for the code that should make the work:</p>
  
  <pre><code>$result = mysql_query($insert_cat);
  while ($row = mysql_fetch_assoc($result))
  {
      //assegno variabili per l'array associativo
      $idcat = $row["id_categorie"];
      $descat = $row["categoria"];
  
      //inizio a ciclare all'interno degli array per ricavare le categorie
      $ar_id=explode('&gt;',$idcat);
      $ar_des=explode('&gt;',$descat);
  
      foreach($ar_id as $value_id)
      {
  
          foreach($ar_des as $value_des)
          {
  
          }
  
          echo $value_id.'|'.$value_des."\n";
      }
  }
  </code></pre>
  
  <p>The problem is: how can I (for testing) echoing what should be inserted in the table?<br />
  I've tried but with no luck.</p>