title: How to call and display a database in phpMyAdmin
body: <p>My assignment is to create two tables in phpMyAdmin, and then to create a simple form where the user can click a button and have the two tables displayed. I have the landing page for the assignment finished with header and search bar and button, but I'm having trouble figuring out how to bring the two tables in from the database and display them once the button is clicked.</p>
  
  <p>I have had a tutor help with some of the code but I haven't been able to get it to work properly and would love any further help.</p>
  
  <p>Here is the code I have now (the two separate php code chunks are two ways people tried to help me do it but I don't know which works or how to implement it):</p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;?php
  $servername = "localhost";
  $username = "username";
  $password = "password";
  
  $conn = new mysqli($servername, $username, $password);
  
  if ($conn-&gt;connect_error) {die("Connection Failed: " . $conn-&gt;connect_error);
  }
  echo "Connected Successfully";
  ?&gt;
  &lt;html&gt;
  &lt;head&gt;
  &lt;/head&gt;
  &lt;body&gt;
  &lt;h1&gt;Health Club Patron and Class Information&lt;/h1&gt;
  &lt;form name="contact-form" action="" method="post" id="contact-form"&gt;
  &lt;div class="form-group"&gt;
  &lt;label for="Search"&gt;Search&lt;/label&gt;
  &lt;input type="text" class="form-control" search="your_name" placeholder="Search" required&gt;
  &lt;/div&gt;
  &lt;button type="print" class="btn btn-primary" name="print" value="Print" id="submit_form"&gt;Print&lt;/button&gt;
  &lt;/form&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  
  
  
  $connection = mysql_connect('localhost', 'root', ''); //The Blank string is the password
  
  mysql_select_db('hrmwaitrose');
  
  $query = "SELECT * FROM employee"; //You don't need a ; like you do in SQL
  
  $result = mysql_query($query);
  
  echo "&lt;table&gt;"; // start a table tag in the HTML
  
  while($row = mysql_fetch_array($result)){   //Creates a loop to loop through results
  
  echo "&lt;tr&gt;&lt;td&gt;" . $row['name'] . "&lt;/td&gt;&lt;td&gt;" . $row['age'] . "&lt;/td&gt;&lt;/tr&gt;";  //$row['index'] the index here is a field name
  
  }
  
  echo "&lt;/table&gt;"; //Close the table in HTML
  
  mysql_close(); //Make sure to close out the database connection
  </code></pre>