开发者

Data not entering the table

开发者 https://www.devze.com 2022-12-29 08:46 出处:网络
//loop through usernames to add to league table for ($i = 0; $i < count($user); $i++) { //set some new variables in an array
        //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);
        }
    }   

I use this code to add to the league table, the following is more code:

   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);

}

Can you see any obvious reason why this isn't happenin开发者_如何学JAVAg? Thanks


SQL error stands out to me:

INSERT INTO `$_SESSION[comp_name]` ( `user` , `team` ,    `home_games_played` , `home_wins` , `home_draws` , `home_losses` ,`home_points,     `home_goals_for` , `home_goals_against`

You're missing a back tic after home_points.

0

精彩评论

暂无评论...
验证码 换一张
取 消