//loop through usernames to add to league table
for ($i = 0; $i < count($user); $i++)
{
//set some new variables in an array
$username = $user[$i];
$squad = $team[$i];
//add details to league table
if ( $username != "Ghost")
{
$database->addUsersToLeagueTable($username, $squad);
}
}
我使用此代码添加到联赛表中,以下是更多代码:
function addUsersToLeagueTable($username, $squad)
{
$q = "INSERT INTO `$_SESSION[comp_name]` ( `user` , `team` , `home_games_played` , `home_wins` , `home_draws` , `home_losses` ,`home_points, `home_goals_for` , `home_goals_against` , `away_games_played` , `away_wins` , `away_draws` , `away_losses` , `away_points` , `away_goals_for` , `away_goals_against` )
VALUES (
'$username', '$squad', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0')";
return mysql_query($q, $this->connection);
}
你能看到为什么没有发生这种情况的明显原因吗? 感谢
答案 0 :(得分:4)
SQL错误让我很突出:
INSERT INTO `$_SESSION[comp_name]` ( `user` , `team` , `home_games_played` , `home_wins` , `home_draws` , `home_losses` ,`home_points, `home_goals_for` , `home_goals_against`
你在home_points之后错过了一个回归时间。