title: Retrieve data from MySQL Database on button click with PHP
body: <p>So I have a html table made with my competition names, dates and every row of the table has a button, that corresponds to the competition name. What I would like to know is, if it is possible to show the results of that competition in a modal when that button is clicked? The results of each competition is stored in a separate table in the database to that of the competition names and dates.</p>
  
  <p>My table at the minute is looking like this</p>
  
  <pre><code>echo "
        &lt;div align = 'center'&gt;
        &lt;table class = 'reportTable' border = '1' cellpadding = '5' width = '90%'&gt;
           &lt;tr&gt;
              &lt;th&gt; Competition Number &lt;/th&gt;
              &lt;th&gt; Competition Name &lt;/th&gt;
              &lt;th&gt; Date Of Competition &lt;/th&gt;
              &lt;th&gt; Results &lt;/th&gt;
            &lt;/tr&gt;
            ";
  
           while ($row = mysql_fetch_array($result))
           {
               echo "
                    &lt;tr align = 'center'&gt;
                        &lt;td&gt;".$row['competitionID']."&lt;/td&gt;
                        &lt;td&gt;".$row['competitionName']."&lt;/td&gt;
                        &lt;td&gt;".date("d/m/Y", strtotime($row['dateStarting']))."&lt;/td&gt;
                        &lt;td&gt;&lt;a href = results.php?id=".$row['competitionID']."&gt;Results&lt;/a&gt;&lt;/td&gt;&lt;/td&gt;
                    &lt;/tr&gt;
                    ";
            }
  
            echo "&lt;/table&gt;
                &lt;/div&gt;";
  </code></pre>
  
  <p>What I am trying to achieve is when a I click on a button that corresponds to the competition, it will show a modal on the page that shows the results of that competition only.</p>
  
  <p>Any input is appreciated.</p>
  
  <p>Thanks!</p>