Constructing an if, if else, else statement
<pre><code>/* Errors exist, have user correct them */
    if($form-&gt;num_errors &gt; 0)
    {
         return 1;  //Errors with form
    }
     /* No errors, add the new account to the */
    else if($database-&gt;addLeagueInformation($subname, $subformat, $subgame, $subseason, $subwindow, $subadmin, $subchampion, $subtype))
    {
        $database-&gt;addLeagueTable();
        $_SESSION['players'] == $subplayers;
        $comp_name == '$format_$game_$name_$season';
        $_SESSION['comp_name'] == $comp_name;
        return 0;  //New user added succesfully
    }
    else
    {
        return 2;  //Registration attempt failed
    }
</code></pre>

<p>At the moment this isn't doing any of these things\:</p>

<pre><code>$database-&gt;addLeagueTable();
    $_SESSION['players'] == $subplayers;
    $comp_name == '$format_$game_$name_$season';
    $_SESSION['comp_name'] == $comp_name;
</code></pre>

<p>Is there a better way to do this?</p>

<p>Editing! </p>

<pre><code>$comp_name = "$subformat_$subgame_$subname_$subseason";
        $_SESSION['comp_name'] = $comp_name;
</code></pre>

<p>This code is only generating whats in $subseason?
Is there an obvious reason for this?</p>

<p>Further editing!</p>

<pre><code>else if($database-&gt;addLeagueInformation($subname, $subformat, $subgame, $subseason, $subwindow, $subadmin, $subchampion, $subtype))
    {
        $_SESSION['players'] = $subplayers;
        $comp_name = "$subformat_$subgame_$subname_$subseason";
        $_SESSION['comp_name'] = $comp_name;
        $database-&gt;addLeagueTable();
        return 0;  //New user added succesfully
    }
</code></pre>

<p>And the function addLeagueTable()</p>

<pre><code>function addLeagueTable() {
   $q = "CREATE TABLE `$_SESSION[comp_name]` (
     `user` VARCHAR( 30 ) NOT NULL ,
        `team` VARCHAR( 40 ) NOT NULL ,
        `home_games_played` INT( 3 ) NULL DEFAULT '0',
        `home_wins` INT( 3 ) NULL DEFAULT '0',
        `home_draws` INT( 3 ) NULL DEFAULT '0',
        `home_losses` INT( 3 ) NULL DEFAULT '0',
        `home_points` INT( 3 ) NULL DEFAULT '0',
        `home_goals_for` INT( 3 ) NULL DEFAULT '0',
        `home_goals_against` INT( 3 ) NULL DEFAULT '0',
        `away_games_played` INT( 3 ) NULL DEFAULT '0',
        `away_wins` INT( 3 ) NULL DEFAULT '0',
        `away_draws` INT( 3 ) NULL DEFAULT '0',
        `away_losses` INT( 3 ) NULL DEFAULT '0',
        `away_points` INT( 3 ) NULL DEFAULT '0',
        `away_goals_for` INT( 3 ) NULL DEFAULT '0',
        `away_goals_against` INT( 3 )  NULL DEFAULT '0'
        )";
   return mysql_query($q, $this-&gt;connection);
}
</code></pre>

<p>any ideas?</p>

<p>How i pass..</p>

<pre><code>      $retval = $session-&gt;createLeague($_POST['name'], $_POST['players'], $_POST['format'], $_POST['game'], $_POST['season'], $_POST['window'], $_POST['admin'], $_POST['champion'], $_POST['type']);
</code></pre>

<p>And this sends them to the function the addLeagueInformation is sent to!</p>
