Forum Moderators: coopster
[/IMG] [img137.imageshack.us]
// Make your database connection - see manual
$results = null;
$query = "select `Name`,`PhotoLink`,`BIO` from `STATS` where `Nick Name` = '" . mysql_real_scape_string(strip_tags($_POST['opponent'])) . "'";
$result = mysql_query($query) or die("Cannot query stats: " . mysql_error());
while ($row = mysql_fetch_array($result)) {
$results .="
<img style=\"float: left;\" src=\"" . $row['PhotoLink'] . "\" alt=\"" . $row['Name'] . "\">
<p>Name: " . $row['Name'] . "</p>
<p>" . $row['BIO'] . "</p>
";
}
if ($results) {
echo "
<h1>Player Stats</h1>
$results
";
}
else { echo "<p>No results were found</p>"; }
//
echo "<h2>Events</h2>";
//
$results = null; // reset
$query = "select * from `event results` order by `Date` desc";
$result = mysql_query($query) or die("Cannot query events: " . mysql_error());
while ($row = mysql_fetch_array($result)) {
$results .="
<tr>
<td>" . $row['Result'] . "</td>
<td>" . $row['Opponent'] . "</td>
<td>" . $row['Event title'] . "</td>
<td>" . $row['Round'] . "</td>
<td>" . $row['Date'] . "</td>
<td>" . $row['Time'] . "</td>
</tr>
";
}
if ($results) {
echo "
<table>
<tr>
<th>Result</th>
<th>Opponent</th>
<th>Event title</th>
<th>Round</th>
<th>Date</th>
<th>Time</th>
</tr>
$results
</table>
";
}
else { echo "<p>No events were found.</p>"; }