Looking to change order of stats shown
<p>I tried combining as suggested in a previous link but Im still getting a error. I am fairly new to php so that is why i have two querys.</p>

<p><strong>Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in /home/vhockey/public_html/vhatest/connect.php on line 88</strong></p>

<p>The table is "season12" and the table is "p"</p>

<p>Here is my connect.php file except server info...</p>

<pre><code>function index_team_stats($subconference) {
$return = array();

$query = "SELECT id, teamname, teamnameseason, teamabr 
            FROM teams 
            WHERE subconference = '" . $subconference . "' 
            ORDER BY teamnameseason";

$teams = result_array($query);
foreach ($teams as $team) 
{
    $query = "SELECT gp, w, l, ol, p 
                FROM season12 
                WHERE team = '" . $team['teamnameseason'] . "' 
                ORDER BY p DESC 
                LIMIT 0,20'; ";

    $results = result_array($query);

    if ($results)
    {
        $results[0]['team'] = str_replace($team['teamnameseason'], '', $team['teamname']);
        $results[0]['teamabr'] = $team['teamabr'];
        $results[0]['teamid'] = $team['id'];
        $return[] = $results[0];
    }
}
return $return;
}




function get_team_name($teamnameseason) {



$query = "SELECT teamname FROM teams WHERE teamnameseason = '" . $teamnameseason . "'";



$row = mysql_fetch_row(mysql_query($query));



return str_replace($teamnameseason, '', $row[0]);



}



function result_array($query) {



$results = mysql_query($query) or die("error on: " . $query . " saying: " . mysql_error());



$return = array();



while ($row = mysql_fetch_assoc($results)) {



    $return[] = $row;



}



return $return;



}
</code></pre>

<p>Here is an image of the info ![All info sorted by team PTS from highest to lowest</p>

<p><img src="http://i.stack.imgur.com/eCBuF.png" alt="http://i.stack.imgur.com/eCBuF.png"></p>

<p>Should show Penguins, FLyers, Islanders, Rangers, Devils..</p>
