Hello all,
I'm trying to make a page to display records from a database as a league table with php. The scores are held in the table of the database in as pointwk1_team pointswk2_team etc. These are added together to form a variable that isn't stored in the database called 'totalpoints'. I have put into the sql query to order by 'totalpoints' ascending so it shows the team with the highest points as top of the league but it won't do it. I've tried descending as well and this has no difference.
My code is as follows:
$colname_rs_priv_league = "-1";
if (isset($_GET['privateleague_team'])) {
$colname_rs_priv_league = $_GET['privateleague_team'];
}
mysql_select_db($database_conn_fyp09, $conn_fyp09);
$query_rs_priv_league = sprintf("SELECT username_team, teamname_team, pointswk1_team, pointswk2_team, pointswk3_team, pointswk4_team, pointswk5_team, privateleague_team, pointswk1_team + pointswk2_team + pointswk3_team + pointswk4_team + pointswk5_team AS 'totalpoints' FROM tbl_teams WHERE privateleague_team = %s ORDER BY 'totalpoints' ASC", GetSQLValueString($colname_rs_priv_league, "int"));
$rs_priv_league = mysql_query($query_rs_priv_league, $conn_fyp09) or die(mysql_error());
$row_rs_priv_league = mysql_fetch_assoc($rs_priv_league);
$totalRows_rs_priv_league = mysql_num_rows($rs_priv_league);
?>
I'm using Dreamweaver cs4. Any help or advice would be great thank you