I'm nearly there. My site is up and running and now I just have to add all of the entries to the database. Thank you for all of your help.
HOWEVER!
Quick query you may be able to help with.
Take a look at my site at http://www.didymus.org.uk/tree.php
If you enter an invalid URL in to the QIK-JUMP box (i.e. 999 or 000) you'll see that the iframe on the right simply becomes blank.
What I WANT to do is tell PHP that if there is no data in the MySQL database using the key entered, to display a default page (i.e. "Sorry, the page you requested doesn't exist).
Any idea how to do this?
Here is the code for my display.php page which is the one I would need to change:
Code: Select all
<?php
/* Program: display.php
* Desc: Displays all details of selected individual.
*/
?>
<html>
<head><title>Individual Biographical Information</title></head>
<body topmargin="0" leftmargin="0" rightmargin="0" bottommargin="0" style="border-style: solid; border-width: 1px">
<?php
include_once("*******.inc.php");
$cxn = mysql_connect($host,$user,$password)
or die ("couldn't connect to server");
mysql_select_db($database);
$urn=$_GET['urn']; //urn passed by hyperlink
$urn = strtoupper($urn);
$query = "SELECT * FROM tree WHERE urn='$urn'";
$result = mysql_query($query)
or die ("Couldn't execute query.");
$link = "http://www.didymus.org.uk/display.php?urn=";
$rowht = "valign='top'";
$rowcl = "bgcolor='#CCFFCC' valign='top'";
$text = "font face='Arial' size='1'";
$hltext = "font face='Arial' size='1' color='#000000'";
$nw = "nowrap";
/* Display results in a table */
$urn = ucfirst($urn);
while($row = mysql_fetch_assoc($result))
{
extract($row);
echo "<p align='center'><font face='Arial' size='3'><b>$surname, $forename $middlenames ($yearofbirth)</font></b><br><font face='Arial' size='1'>- B I O G R A P H I C A L D E T A I L S -</p>";
echo "<table cellspacing='0' width='450' align='center'>";
echo "<tr><td colspan='3'><hr /></td></tr>";
echo "<tr><td colspan='3' align='center'><a href='census.php?urn=$urn'><img border='0' src='$census'></a><a href='certs.php?urn=$urn'><img border='0' src='$certificates'></a><img border='0' src='tree/graphics/bio_off.gif'><a href='photos.php?urn=$urn'><img border='0' src='$photographs'></a><a href='stories.php?urn=$urn'><img border='0' src='$scrapbook'></a></td></tr>";
echo "<tr><td colspan='3'><hr /></td></tr>";
echo " <tr>\n
<td $rowht $nw><$text><b>URN:</font></b></td><td><$text>$urn</font></td>\n
<tr $rowcl><td $nw><$text><b>SURNAME:</font></b></td><td><$text>$surname</font></td>\n</tr>
<tr $rowht><td $nw><$text><b>FORENAME(S):</font></b></td><td><$text>$forename $middlenames</font></td>\n</tr>
<tr $rowcl><td $nw><$text><b>DATE OF BIRTH:</font></b></td><td><$text>$dateofbirth</font></td>\n</tr>
<tr $rowht><td $nw><$text><b>PLACE OF BIRTH:</font></b></td><td><$text>$placeofbirth</font></td>\n</tr>
<tr $rowcl><td $nw><$text><b>MOTHER:</font></b></td><td><a href='$link$motherurn'><$hltext>$mother</a>
</font></td>\n</tr>
<tr $rowht><td $nw><$text><b>FATHER:</font></b></td><td><a href='$link$fatherurn'><$hltext>$father</a></font></td>\n</tr>
<tr $rowcl><td $nw><$text><b>SIBLINGS:</font></b></td><td><a href='$link$sibling1urn'><$hltext>$sibling1</a></font></td>\n</tr>
<tr $rowcl><td></td><td><a href='$link$sibling2urn'><$hltext>$sibling2</a></font></td>\n</tr>
<tr $rowcl><td></td><td><a href='$link$sibling3urn'><$hltext>$sibling3</a></font></td>\n</tr>
<tr $rowcl><td></td><td><a href='$link$sibling4urn'><$hltext>$sibling4</a></font></td>\n</tr>
<tr $rowcl><td></td><td><a href='$link$sibling5urn'><$hltext>$sibling5</a></font></td>\n</tr>
<tr $rowcl><td></td><td><a href='$link$sibling6urn'><$hltext>$sibling6</a></font></td>\n</tr>
<tr $rowcl><td></td><td><a href='$link$sibling7urn'><$hltext>$sibling7</a></font></td>\n</tr>
<tr $rowcl><td></td><td><a href='$link$sibling8urn'><$hltext>$sibling8</a></font></td>\n</tr>
<tr $rowcl><td></td><td><a href='$link$sibling9urn'><$hltext>$sibling9</a></font></td>\n</tr>
<tr $rowcl><td></td><td><a href='$link$sibling10urn'><$hltext>$sibling10</a></font></td>\n</tr>
<tr $rowht><td $nw><$text><b>CHRISTENING DATE:</font></b></td><td><$text>$christeningdate</font></td>\n</tr>
<tr $rowcl><td $nw><$text><b>CHRISTENING PLACE:</font></b></td><td><$text>$christeningplace</font></td>\n</tr>
<tr $rowht><td $nw><$text><b>SPOUSE 1:</font></b></td><td><a href='$link$spouse1urn'><$hltext>$spouse1</a></font></td>\n</tr>
<tr $rowcl><td $nw><$text><b>MARRIAGE DATE:</font></b></td><td><$text>$spouse1marriagedate</font></td>\n</tr>
<tr $rowht><td $nw><$text><b>MARRIAGE PLACE:</font></b></td><td><$text>$spouse1marriageplace</font></td>\n</tr>
<tr $rowcl><td $nw><$text><b>CHILDREN:</font></b></td><td><a href='$link$spouse1child1urn'><$hltext>$spouse1child1</a></font></td>\n</tr>
<tr $rowcl><td></td><td><a href='$link$spouse1child2urn'><$hltext>$spouse1child2</a></font></td>\n</tr>
<tr $rowcl><td></td><td><a href='$link$spouse1child3urn'><$hltext>$spouse1child3</a></font></td>\n</tr>
<tr $rowcl><td></td><td><a href='$link$spouse1child4urn'><$hltext>$spouse1child4</a></font></td>\n</tr>
<tr $rowcl><td></td><td><a href='$link$spouse1child5urn'><$hltext>$spouse1child5</a></font></td>\n</tr>
<tr $rowcl><td></td><td><a href='$link$spouse1child6urn'><$hltext>$spouse1child6</a></font></td>\n</tr>
<tr $rowcl><td></td><td><a href='$link$spouse1child7urn'><$hltext>$spouse1child7</a></font></td>\n</tr>
<tr $rowcl><td></td><td><a href='$link$spouse1child8urn'><$hltext>$spouse1child8</a></font></td>\n</tr>
<tr $rowcl><td></td><td><a href='$link$spouse1child9urn'><$hltext>$spouse1child9</a></font></td>\n</tr>
<tr $rowcl><td></td><td><a href='$link$spouse1child10urn'><$hltext>$spouse1child10</a></font></td>\n</tr>
<tr $rowht><td $nw><$text><b>SPOUSE 2:</font></b></td><td><a href='$link$spouse2urn'><$hltext>$spouse2</a></font></td>\n</tr>
<tr $rowcl><td $nw><$text><b>MARRIAGE DATE:</font></b></td><td><$text>$spouse2marriagedate</font></td>\n</tr>
<tr $rowht><td $nw><$text><b>MARRIAGE PLACE:</font></b></td><td><$text>$spouse2marriageplace</font></td>\n</tr>
<tr $rowcl><td $nw><$text><b>CHILDREN:</font></b></td><td><a href='$link$spouse2child1urn'><$hltext>$spouse2child1</a></font></td>\n</tr>
<tr $rowcl><td></td><td><a href='$link$spouse2child2urn'><$hltext>$spouse2child2</a></font></td>\n</tr>
<tr $rowcl><td></td><td><a href='$link$spouse2child3urn'><$hltext>$spouse2child3</a></font></td>\n</tr>
<tr $rowcl><td></td><td><a href='$link$spouse2child4urn'><$hltext>$spouse2child4</a></font></td>\n</tr>
<tr $rowcl><td></td><td><a href='$link$spouse2child5urn'><$hltext>$spouse2child5</a></font></td>\n</tr>
<tr $rowcl><td></td><td><a href='$link$spouse2child6urn'><$hltext>$spouse2child6</a></font></td>\n</tr>
<tr $rowcl><td></td><td><a href='$link$spouse2child7urn'><$hltext>$spouse2child7</a></font></td>\n</tr>
<tr $rowcl><td></td><td><a href='$link$spouse2child8urn'><$hltext>$spouse2child8</a></font></td>\n</tr>
<tr $rowcl><td></td><td><a href='$link$spouse2child9urn'><$hltext>$spouse2child9</a></font></td>\n</tr>
<tr $rowcl><td></td><td><a href='$link$spouse2child10urn'><$hltext>$spouse2child10</a></font></td>\n</tr>
<tr $rowht><td $nw><$text><b>OCCUPATION:</font></b></td><td><$text>$occupation</font></td>\n</tr>
<tr $rowcl><td $nw><$text><b>DATE OF DEATH:</font></b></td><td><$text>$dateofdeath</font></td>\n</tr>
<tr $rowht><td $nw><$text><b>PLACE OF DEATH:</font></b></td><td><$text>$placeofdeath</font></td>\n</tr>
<tr $rowcl><td $nw><$text><b>CAUSE OF DEATH:</font></b></td><td><$text>$causeofdeath</font></td>\n</tr>
<tr $rowht><td $nw><$text><b>NOTES:</font></b></td><td><$text>$notes</font></td>\n</tr>
</tr>\n";
echo "<tr><td colspan='3'></td></tr>\n";
}
echo "</table>\n";
?>
</body></html>
Kris.