showDetails.php
Source of showDetails.php
<!DOCTYPE html PUBLIC
"-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html lang = "EN" xml:lang = "EN" dir = "ltr">
<head>
<meta http-equiv="content-type" content="text/xml; charset=iso-8859-1" />
<title>showDetails.php</title>
<style type = "text/css">
dt {
float: left;
width: 4em;
clear: left;
}
dd {
float: left;
width: 20em;
}
</style>
</head>
<body>
<?php
//connect
$conn = mysql_connect("localhost", "xfd", "xfdaio");
//change this password and username to work on your system
mysql_select_db("xfd");
//get most information for requested hero
$hero = "binary boy";
$query = <<<HERE
SELECT
*
FROM
heroMissionView
WHERE
hero = '$hero'
HERE;
print "<dl> \n";
$result = mysql_query($query, $conn);
$row = mysql_fetch_assoc($result);
foreach ($row as $field => $value){
print <<<HERE
<dt>$field</dt>
<dd>$value</dd>
HERE;
} // end foreach
print " <dt>powers</dt> \n";
print " <dd> \n";
print " <ul> \n";
//create another query to grab the powers
$query = <<<HERE
SELECT
power
FROM
heroPowerView
WHERE hero = '$hero'
HERE;
//put powers in an unordered list
$result = mysql_query($query, $conn);
while ($row = mysql_fetch_assoc($result)){
foreach ($row as $field => $value){
print " <li>$value</li> \n";
} // end foreach
} // end while looop
print " </ul> \n";
print "</dd> \n";
print "</dl> \n";
?>
</body>
</html>