text: Q:
  
  PHP MySqli How to SELECT Everything from a Table for which i don't know the name?
  
  I'm working on a personal project something like a document management system.
  I'm creating new folders and and table in DB with the same name as the folder.
  I can list all of them, and i want when i click on the Table name listed in HTML table, to show everything that's inside that table.
  But i don't know the name of the table.
  And i'm getting "0 results".
  
  Screenshot of the Database Tables ->
  DB 
  Screenshot of the "O results"
  -> Results 
  Screenshot of listing the tables -> Tables listed
  
  However i can see in the URL that i'm in the "correct" table because it says the name of my table.
  I know that the issue is somewhere in the SELECT statement from view.php in which i don't know how to select the table that i don't know the name of :-)
  Can someone please help me?
  Thanks a lot.
  This is my index code where i list all of the Tables from DB as buttons:
  <div class="container-fluid">
    <div class="row">
  
  <div class="col-md-4 col-xl-4 text-center ml-sm-2 ml-md-5 ml-lg-5 mt-5">
    <div class="alert alert-danger mb-0"><strong>TABLES from DATABASE:</strong></div>
  
      <table class="table table-bordered table-hover text-center">
  
        <tr class="title">
          <th>Folder Name:</th>
        </tr>
  
    <?php
  
      $conn = mysqli_connect("localhost", "root", "", "folder");
  
      if (!$conn) {
         die("Connection failed: " . mysqli_connect_error());
      }
  
       $sql = "SELECT table_name FROM information_schema.tables where table_schema='folder';";
       $result = $conn-> query($sql);
  
        if ($result) {
        while ($row = $result-> fetch_assoc()) {
  
        echo "<a href='view.php?". $row['table_name'] ."' ><span style='font-size: 19px; color: #3277b6; margin-right: 15px;'><i class='far fa-eye'></i></span></a>";
  
      }
                }
            else {
              echo "0 results";
      }
  
      $conn-> close();
  
      ?>
  
      </table>
  </div>
  
  This is the view.php code:
  <body>
  
       <div class="container">
        <div class="row mt-5 ml-5">
  
         <div class="col-md-8 col-xl-11 text-center ml-sm-2 ml-md-5 ml-lg-5 mt-5">
           <div class="alert alert-danger mb-0">
             <a href="index.php" class="btn btn-dark mr-5" role="button">Go Back</a>
        </div>
  
         <div style="overflow-x:auto;">
           <table class="table table-bordered table-hover text-center">
              <tr>
                <th>Name:</th>
                 <th>Create at:</th>
              </tr>
  
  <?php
  
  $conn = mysqli_connect("localhost", "root", "", "folder");
  
  if (!$conn) {
  die("Connection failed: " . mysqli_connect_error());
  }
  
  $sql = "SELECT * FROM information_schema.tables where table_name = ?";
  $result = $conn-> query($sql);
  
  if ($result) {
  while ($row = $result-> fetch_assoc()) {
  echo "<tr>
           <td>".$row['name']."</td>
           <td>".$row['created_at']."</td>
        </tr>";
  }
  echo "</table>";
  }
  else {
  echo "0 results";
  }
  
  $conn-> close();
  
  ?>
  
                        </table>
  
                        </div>
  
                        </div>
              </div>
          </div>
  
          <!-- Optional JavaScript -->
          <!-- jQuery first, then Popper.js, then Bootstrap JSs -->
          <script src="js/jquery-3.3.1.min.js"></script>
          <script src="js/bootstrap.bundle.min.js"></script>
          <script src="js/theme-script.js"></script>
  
  </body>
  </html>
  
  A:
  
  Change the following line:
  echo "<a href='view.php?". $row['table_name'] ."' ><span style='font-size: 19px; color: #3277b6; margin-right: 15px;'><i class='far fa-eye'></i></span></a>";
  
  to
  echo "<a href='view.php?table_name=". $row['table_name'] ."' ><span style='font-size: 19px; color: #3277b6; margin-right: 15px;'><i class='far fa-eye'></i></span></a>";
  
  And then change the following line:
  $sql = "SELECT * FROM information_schema.tables where table_name = ?";
  
  to
  $sql = "SELECT * FROM information_schema.tables where table_name = '{$_REQUEST['table_name']}'";
  
  The caveat is that this is a pretty big security risk as it is, and you need to ensure that the variable is cleaned up before injecting it in to your SQL code.
  Final thing, you're not actually doing any error catching, so change this:
  else {
  echo "0 results";
  }
  
  to
  else {
  echo $conn->error;
  }
  
  