Rodney,
Yeah I ran a query to start let me back the code up and show you
function sql_insertPlayerPassingStats($id, $year, $table)
{
$db_table = MYSQL_PASSING;
if (!sql_emptyStats($db_table, $id, $year))
return errorPrint("The call to sql_emptyStats() in sql_insertPlayerPassingStats($id, $year, $table) failed");
$cmp = $table[2]; $att = $table[3]; $yds = $table[4]; $sack = $table[7]; $td = $table[8];
$int = $table[9]; $long = $table[10];
$query = "INSERT INTO $db_table "
."(`id`, `year`, cmp, att, yds, sack, td, `int`, `long`) "
."VALUES ($id, $year, $cmp, $att, $yds, $sack, $td, $int, $long)";
$result = @mysql_query($query);
if ($result == false)
return errorPrint("The following query in sql_insertPlayerSeasonPassingStats($id, $year, $table); failed: <p><tt>$query</tt></p>");
return true;
}
function sql_insertPlayerGbgPassingStats($id, $year, $table)
{
$db_table = MYSQL_PASSING;
$weeklydb_table = MYSQL_GBGPASSING;
$cmp = $table[2]; $att = $table[3]; $yds = $table[4]; $sack = $table[7]; $td = $table[8];
$int = $table[9]; $long = $table[10]; $wk = $_POST["wk"];
$query = "INSERT INTO $weeklydb_table "
."(`id`, `year`, wk, cmp, att, yds, sack, td, `int`, `long`) "
."SELECT (id, `year`, $wk, $cmp-cmp, $att-att, $yds-yds, $sack-sack, $td-td, $int-`int`, IF(`long`>$long,`long`,$long) "
."FROM $db_table "
."WHERE id = $id AND year = $year ";
$result = @mysql_query($query);
echo $query;
if ($result == false)
return errorPrint("The following query in sql_insertPlayerWeeklyPassingStats($id, $year, $table); failed: <p><tt>$query</tt></p>");
return true;
}
See the 1st function sql_insertPlayerPassingStats takes the data and puts it into MYSQL_PASSING
the 2nd function then takes then puts the correct data in the weekly stats.
This seems to be my issue Rodney
Testing it more the problem has to be here
."SELECT id, `year`, $wk, $cmp-cmp, $att-att, $yds-yds, $sack-sack, $td-td, $int-`int`, IF(`long`>$long,`long`,$long "
cause I can change it to this and it works fine
."SELECT id, `year`, $wk, $cmp, $att, $yds, $sack, $td, $int-, $Long "
The only problem is it imports the season stats into the week stats so It looks like this
lets say my week by week stats were this just cmp and att
12 24
13 20
21 30
it would look like this
ID YEAR WK CMP ATT blah blah
333 2005 1 12 24
333 2005 2 25 44
333 2005 3 46 74
thats why I tried to do this I tried to do this $cmp-cmp, $att-att.
Matt