title: extract values (text) from html table using php mysql
body: <p>Hello I want ot extract text and insert them into a DB table
  this is the code of product description</p>
  
  <pre><code>&gt; &lt;table class="AttrDTable"&gt;&lt;!--@HeaderPlacehoder--&gt;&lt;tr
  &gt; class="AttrDRow"&gt;&lt;td class="AttrDTypeName"&gt;Cod produs (Part number)
  &gt; original&lt;/td&gt;&lt;td class="AttrDValue"&gt;5014702023309&lt;/td&gt;&lt;/tr&gt;&lt;tr
  &gt; class="AttrDAltRow"&gt;&lt;td class="AttrDTypeName"&gt;Nume produs&lt;/td&gt;&lt;td
  &gt; class="AttrDValue"&gt;Pricing gun, single row (8 numeric characters),
  &gt; black&lt;/td&gt;&lt;/tr&gt;&lt;tr class="AttrDRow"&gt;&lt;td
  &gt; class="AttrDTypeName"&gt;Producator&lt;/td&gt;&lt;td class="AttrDValue"&gt;Avery
  &gt; Zweckform&lt;/td&gt;&lt;/tr&gt;&lt;tr class="AttrDAltRow"&gt;&lt;td
  &gt; class="AttrDTypeName"&gt;Clasa produsului&lt;/td&gt;&lt;td
  &gt; class="AttrDValue"&gt;Aparatură pentru
  &gt; birou&lt;/td&gt;&lt;/tr&gt;&lt;/td&gt;&lt;/tr&gt;&lt;!--@FooterPlacehoder--&gt;&lt;/table&gt;
  </code></pre>
  
  <p>I am interested only the values from <code>&lt;td class="AttrDTypeName"&gt;</code> and <code>&lt;td class="AttrDValue"&gt;</code> those values I will enter into database </p>
  
  <p>I have made for html with <code>&lt;br&gt;</code> and <code>&lt;strong&gt;</code> values this is the code </p>
  
  <pre><code>$rand=explode("&amp;lt;br&amp;gt;",$descriere);
      for ($i=0;$i&lt;count($rand);$i++)
          if ($rand[$i]!='')
          {
              $element=explode(": &amp;lt;/strong&amp;gt;",$rand[$i]);
              $element[0]=str_replace("&amp;lt;strong&amp;gt;","",$element[0]);
              $element[1]=str_replace("&amp;nbsp;","",$element[1]);
  
              echo $element[0]."---".$element[1]."##"."&lt;br&gt;";
  
  
              $exista=mysqli_query($conexiune, "SELECT * FROM oc_attribute_description WHERE name='".$element[0]."'") or die(mysqli_error($conexiune));
              if  (!mysqli_num_rows($exista))
                  {
                      mysqli_query($conexiune, "INSERT INTO oc_attribute (attribute_group_id) VALUES ('4')");
                      $id_attr=mysqli_insert_id($conexiune);
                      //inserez descriere atribut nou in tabela
                      mysqli_query($conexiune, "INSERT INTO oc_attribute_description (attribute_id, language_id, name) VALUES ('".$id_attr."', '2', '".$element[0]."')")  or die(mysqli_error($conexiune));
  
                  }
              $atribut=mysqli_fetch_array(mysqli_query($conexiune, "SELECT attribute_id FROM oc_attribute_description WHERE name='".$element[0]."'"));
  
              $exista2=mysqli_query($conexiune, "SELECT * FROM oc_product_attribute WHERE product_id='".$product_id."' AND attribute_id='".$atribut[0]."'") or die(mysqli_error($conexiune));
              if  (!mysqli_num_rows($exista2))
                  {
                      mysqli_query($conexiune, "INSERT INTO oc_product_attribute (product_id, attribute_id, language_id, text) VALUES ('".$product_id."', '".$atribut[0]."', '2', '".$element[1]."')")  or die(mysqli_error($conexiune));
  
                  }
              else
                  mysqli_query($conexiune, "UPDATE oc_product_attribute SET text='".$element[1]."' WHERE product_id='".$product_id."' AND attribute_id='".$atribut[0]."'")  or die(mysqli_error($conexiune));
          }
  </code></pre>
  
  <p>Thanks</p>