Simple php/mysqli question: Echo something from another line using ids

  mysqli, php

I have a database of ponies and I need to print the name of the father of a certain pony. Every pony has it’s own page (example: http://wwww.example.ee/pony.php?id=1)

My database structure is:

ID NAME FATHER_ID MOTHER_ID
id name father_id mother_id

This is how I get all the other data from my database. But this one is something I do not know how to do and don’t know where to start finding a solution. Thank You!

$con=mysqli_connect("xxx");
$id = $_GET['id'];

          $result=mysqli_query($con,"SELECT father_id FROM conn WHERE id ='$id'");

          while($row=mysqli_fetch_array($result))
          {
            echo $row['father_id'];
            }

Source: Ask PHP

LEAVE A COMMENT