Here's what i have so far, but even that doesnt work...
<?
function team_array() {
$r = mysql_query("SELECT * FROM `teams`");
$o = array();
while ($row = mysql_fetch_assoc($r)) {
$id = $row['team_id'];
$o[$id] = $row;
}
return $o;
}
?>
<html>
<head>
<title>content</title>
<link rel="stylesheet" href="madden.css" type="text/css">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<style type="text/css">
<!--
BODY {
scrollbar-base-color:#396193;
scrollbar-face-color:#396193;
background:#396193;
}
-->
</style>
<div class="storycontent">
<p>on this page we will be able to validate results</p>
<table class="storycontent">
<?php
mysql_connect("localhost", "user", "pass");
mysql_select_db("database");
if (isset($_GET['id']) && $_GET['id'] != '') {
$query = "select * from results where `id`={$_GET['id']}";
$result = mysql_query($query);
$teams = team_array();
$echoed = array();
while ($row = mysql_fetch_assoc($result)) {
if (!in_array($row['id'], $echoed)) {
$echoed[] = $row['id'];
$aid = $row['awayteam'];
$hid = $row['hometeam'];
$weekid = $row['id'];
echo <<<EOF
<tr>
<td><a href='game.php?id=$weekid'>ID: {$row['id']}</a></td>
<tr>
<td>week: {$row['week']}</td></tr>
<tr>
<td>Email Of Reporter: {$row['week']}</td></tr>
<tr>
<td>Hometeam:{$teams[$aid]['name']}</td></tr>
<tr>
<td>Home Team Score: {$row['homescore']}</td></tr>
<tr>
<td>Away team: {$teams[$hid]['name']} </td></tr>
<tr>
<td>Away Team Score: {$row['awayscore']}</td></tr>
<tr>
<td>Starting Quarterback: {$row['qb1name']}</td></tr>
<tr>
<td>- {$row['qb1yards']} yds</td></tr>
<tr>
<td class="storycontent">
<input type="submit" name="submit" value="submit">
</td>
</tr>
EOF;
}
}
}
?>
<?php
if (isset($_GET['submit'])) {
$insert = "INSERT INTO QB (
qb_name
qb_yards)
VALUES (
'".$GET['qb1name']."',
'".$GET['qb1yards']."')";
$add_result = $db_object->query($insert);
if (DB::isError($add_result)) {
die($add_result->getMessage());
}
$db_object->disconnect();
?>
<p>Thank you, your results have been added to the database, and we will review them within a day.</p>
<?php
} else { // if form hasn't been submitted
}
?>