title: Create a generic function to generate html tables from mySQL database with Php
body: <p>As you can read in the title, I'm trying to create a generic function in order to generate a table from a mySQL database.
  I want to reuse it for every table I need to create in this project and for the next ones.</p>
  <pre><code>function table_generator($nameTable, $db) {
  
      $requete = $db-&gt;prepare(&quot;SELECT * FROM &quot; . $nameTable);
      $requete-&gt;execute();
      $i = '0';
  
  foreach($requete AS $data) {
          echo &quot;&lt;tr&gt;&quot;;
          foreach($data as $vars){
              echo &quot;&lt;td&gt;$vars&lt;/td&gt;&quot;;
          }
          echo &quot;&lt;/tr&gt;&quot;;
      }
  }
  </code></pre>
  <p>Edit: the echo write every field twice.</p>