title: Mysql+php, how to make a link that shows all data from a record when you press the "headline"
body: <p>As the title says, and this is not probably a question, more a hint how to do it.</p>
  
  <p>I have table with four fields, <strong>id (auto+primary)</strong>, <strong>firstname</strong>, <strong>lastname</strong>, <strong>age</strong>.</p>
  
  <p>On my index page I select *, then I make the firstname to a link which goes to antoher page which I want to show all data for that record.</p>
  
  <p>For the moment I have to do it manually "select * from " where id="2". (the other page) </p>
  
  <p>How do I make the link to autodetect "the id from that record set" and only display data from that record.</p>
  
  <p>You can see my curreny project here, </p>
  
  <p><a href="http://www.adamskymotorkylare.se/business/" rel="nofollow">http://www.adamskymotorkylare.se/business/</a></p>
  
  <p>as you can see, when you click the "firstname" it will always display data where id=2 ( paris hilton ), what I want it to do, it when I click "jack" it will select * from where id="1"</p>
  
  <p>Thanks in advance, Jack</p>
  
  <p>"index page"</p>
  
  <pre><code>$result = mysqli_query($con,"SELECT * FROM persons");
  
  echo "&lt;table width=100%&gt;
  &lt;tr&gt;
  &lt;th&gt;ID&lt;/th&gt;
  &lt;th&gt;Firstname&lt;/th&gt;
  &lt;th&gt;Lastname&lt;/th&gt;
  &lt;th&gt;Age&lt;/th&gt;
  &lt;th&gt;Gender&lt;/th&gt;
  &lt;/tr&gt;";
  
  while($row = mysqli_fetch_array($result))
  {
  
  $id = $row['id'];
  
  echo "&lt;tr&gt;";
  echo "&lt;td&gt;" . $row['id'] .  "&lt;/td&gt;";
  echo "&lt;td&gt; &lt;a href='view_more.php?id= . $id .'&gt;" . $row['firstname'] . "&lt;/a&gt; &lt;/td&gt;";
  echo "&lt;td&gt;" . $row['lastname'] .  "&lt;/td&gt;";
  echo "&lt;td&gt;" . $row['age'] . "&lt;/td&gt;";
  echo "&lt;td&gt;" . $row['gender'] . "&lt;/td&gt;";
  echo "&lt;/tr&gt;";
  }
  echo "&lt;/table&gt;";
  </code></pre>
  
  <p>"viewmore page"</p>
  
  <pre><code>$id = $_get['id'];
  
  $result = mysqli_query($con,"SELECT * FROM persons 
  WHERE id='$id'");
  
  echo "&lt;table width=100%&gt;
  &lt;tr&gt;
  &lt;th&gt;Firstname&lt;/th&gt;
  &lt;th&gt;Lastname&lt;/th&gt;
  &lt;th&gt;Age&lt;/th&gt;
  &lt;th&gt;Gender&lt;/th&gt;
  &lt;/tr&gt;";
  
  while($row = mysqli_fetch_array($result))
  {
  echo "&lt;tr&gt;";
  echo "&lt;td&gt; &lt;a href='#'&gt;" . $row['firstname'] . "&lt;/a&gt; &lt;/td&gt;";
  echo "&lt;td&gt;" . $row['lastname'] .  "&lt;/td&gt;";
  echo "&lt;td&gt;" . $row['age'] . "&lt;/td&gt;";
  echo "&lt;td&gt;" . $row['gender'] . "&lt;/td&gt;";
  echo "&lt;/tr&gt;";
  }
  echo "&lt;/table&gt;";
  </code></pre>