title: How can I get the foreignkey # to other table?
body: <p>I am getting trouble on getting the id's(foreign key from the other tables) </p>
  
  <p><a href="https://i.stack.imgur.com/0aD9Z.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/0aD9Z.png" alt="data struct sample"></a></p>
  
  <p>Here's my code from student_log.php</p>
  
  <pre><code>&lt;tr class="record" style="text-align:center;"&gt;
  &lt;td align="center"&gt;&lt;a href="get_idno.php?idno=&lt;?php echo $row['idno']; ?&gt;" data-toggle="modal"&gt;&lt;?php echo $row['idno']; ?&gt;&lt;/a&gt;&lt;/td&gt;
  &lt;/tr&gt;
  </code></pre>
  
  <p>And Here's my get_idno.php </p>
  
  <pre><code>&lt;?php
  
  $YearNow=Date('Y');
  include('../connection/connect.php');
      $idno=$_GET['idno'];
      $result = $db-&gt;prepare("SELECT * FROM studentvotes,student,candidates where idno = '$idno' AND candidates.idno = student.idno AND student.idno = studentvotes.idno AND syearid = $YearNow ");
  $result-&gt;execute();
  for($i=0; $row = $result-&gt;fetch(); $i++){
  ?&gt;
  
  &lt;tr class="record" style="text-align:center;"&gt;
  &lt;td align="center" &gt;&lt;?php echo $row['idno']; ?&gt;&lt;/td&gt;
  &lt;td align="center" &gt;&lt;?php echo $row['candid']; ?&gt;&lt;/td&gt;
  &lt;td align="center" &gt;&lt;?php echo $row['lastname']; ?&gt;&lt;/td&gt;
  &lt;td align="center" &gt;&lt;?php echo $row['firstname']; ?&gt;&lt;/td&gt;
    &lt;/tr&gt;
      &lt;?php
              }
                  ?&gt;
  </code></pre>
  
  <p>I think because of <code>$idno=$_GET['idno'];</code>? Any help please</p>