Ok so i had a go using the little knowledge that i have and came up with something that works but would be very long winded and i am sure it could be but down. Of the sample code below only produces the horse and then its Sire - i could then carry on to build up the horses but like i say i think its long winded and there must be a easier way. Here is code, ive included num_row because when i make it up properly i will use this in a if else statement to print something when there is no results:
<?
include("dbinfo.inc.php");
mysql_connect(localhost,$username,$password);
@mysql_select_db($database) or die( "Unable to select database");
$query0 = "select sire,dam,dob,horse from horse where id=$id";
$numresults0=mysql_query($query0);
$numrows0=mysql_num_rows($numresults0);
$result0 = mysql_query($query0) or die("Error - Results 0");
$sire1=mysql_result($result0,$i,"sire");
$dam1=mysql_result($result0,$i,"dam");
$horse0=mysql_result($result0,$i,"horse");
$dob0=mysql_result($result0,$i,"dob");
echo "$dob0";
echo "$horse0";
echo "<br><br>";
$query1 = "select id from horse where horse=\"$sire1\"";
$result1 = mysql_query($query1) or die("Result1");
$id1=mysql_result($result1,$i,"id");
$query2 = "select sire,dam,dob,horse from horse where id=$id1";
$result2 = mysql_query($query2) or die("Bad Error");
$sire2=mysql_result($result2,$i,"sire");
$dam2=mysql_result($result2,$i,"dam");
$horse1=mysql_result($result2,$i,"horse");
$dob1=mysql_result($result0,$i,"dob");
echo "$dob1";
echo "$horse1";
?>