Ok I am trying to import date into a table called MYSQL_GBGPASSING I found out that original function function sql_insertPlayerGbgPassingStats($id, $year, $wk, $table) was never being defined so it was never ran so I added my query into a previously defined query. Now I get an error, at least it is trying to do the math. here is the code
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>");
true;
$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;
}
function sql_emptyStats($db_table, $id, $year)
{
$query = "DELETE FROM $db_table WHERE id = $id AND `year` = $year";
$result = @mysql_query($query);
if ($result == false)
return errorPrint("The following query in sql_emptyStats($db_table, $id, $year); failed: <p><tt>$query</tt></p>");
return true;
}
Now here is my error I recieve
The following query in sql_insertPlayerWeeklyPassingStats(7030, 2005, Array); failed:
INSERT INTO ind_gbgpassing (id, year, wk, 'cmp', att, yds, sack, td, int, long) SELECT (id, year, 1, 21-'cmp', 31-att, 311-yds, 1-sack, 3-td, 1-int, IF(long>65,long,65) FROM ind_passing WHERE id = 7030 AND year = 2005