I'm trying real hard here but am getting stuck every so often. Could someone look at my code for this page and tell me how I display name of author, organisation, sector, format instead of id numbers.
Here is my code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>The Environmental Publcations Database</title>
<meta http-equiv="content-type"
content="text/html; charset=iso-8859-1" />
</head>
<body>
<?php
$dbcnx = @mysql_connect('localhost', 'root', '');
if (!$dbcnx) {
exit('<p>Unable to connect to the ' .
'database server at this time.</p>');
}
if (!@mysql_select_db('ijdb')) {
exit('<p>Unable to locate the publication ' .
'database at this time.</p>');
}
// Get the publication name from the database
$id = $_GET['id'];
$pub = @(
"SELECT pubname, pubdesc, pubno, pubdate, authorid, formatid, orgid, pages, cost FROM pub WHERE id='$id'");
if (!$pub) {
exit('Unable to load the publication from the database.');
}
if (mysql_num_rows($pub) < 1) {
exit('Could not locate the specified pub ID.');
}
$pub = mysql_fetch_array($pub);
$pubname = $pub['pubname'];
$pubdesc = $pub['pubdesc'];
$pubdate = $pub['pubdate'];
$cost = $pub['cost'];
$pubno = $pub['pubno'];
$pages = $pub['pages'];
$aid = $pub['authorid'];
$fid = $pub['formatid'];
$oid = $pub['orgid'];
//Filter out html code
$pubname = htmlspecialchars($pubname);
echo "<h3>Search Results - $pubname</h3>";
echo "<p><b>Author:</b>$aid<br><b>Description: </b>$pubdesc<br><b>Format:</b>$fnamed<br><b>Date:</b>$pubdate<br><b>Available from:</b>$oid<br><b>Cost:</b>$cost<br><b>Publication Number:</b>$pubno<br><b>Pages:</b>$pages<br><b>Sector:</b>$cid</p>";
?>
<p><a href="index.php">Search again </a> </p>
</body>
</html>