title: Reading files from multiple directions
body: <p>I am trying to make a script that reads .sql files from multiple directories in a certain folder, and then to execute them into the database.</p>
  
  <p>How would I make my code below able to read multiple folders. [These folders will be added/removed in future so I need it to just automatic find any folder without any partciular names.</p>
  
  <p>So for example I have a folder called "mysqls" and inside that folder I have other folders such as 'text1', 'test2'. Test1 and test2 have different .sql files in that I want to be excuted.</p>
  
  <pre><code>&lt;?php
  $dirf    = 'mysqls';
  $dir = scandir($dirf);
  
  unset($dir['0']);
  unset($dir['1']);
  
  foreach($dir as $file) {
  
  
         $sql = file_get_contents($dirf . '/'. $file);
         $qr = $dbh-&gt;exec($sql);
  }
  
  ?&gt; 
  </code></pre>