title: Parsing XML data using php to put into mysql database
body: <p>I have been asked to parse a simple file which is stored as an XML file, the data is to be then put into a mysql database.</p>
  
  <p>However I have absolutely no clue what to do and after looking online all the examples given seem either too complicated for my problem or not the right solution. The XML file looks like this:</p>
  
  <pre><code>&lt;shop&gt;
  &lt;products&gt;
      &lt;product id="1" name="Cornetto" price="1.20" description="Traditional Cornetto" /&gt;
      &lt;product id="2" name="Smarties" price="1.00" description="Smarties Icecream" /&gt;
  &lt;/products&gt;
  
  &lt;stocks&gt;
      &lt;stock id="1" amount="242" price="pounds" /&gt;
      &lt;stock id="2" amount="11" price="pounds" /&gt;
  &lt;/stocks&gt;
  </code></pre>
  
  <p>I've tried looking at SimpleXML and I think that's the direction I have to go but I just have no idea.</p>
  
  <p>Any help or pointers would be great.</p>