This is my first post here and I am still learning PHP, I have gone through and fixed all the bugs that I could find, T-strings and what not but I get the following error “You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘ORDER BY Players.LastName’ at line 12” Line 12 on my Notepad ++ is a blank line between the and <?php I have gone through with my limited knowledge and tried to find out what the problem could be but without more of an error to help me I can’t seem to get any further. Thanks For taking a look at this. I think I formatted this correctly.
[code]
} td img { vertical-align: top; } CNGHL Database [/code][php]<?php
// Connects to your Database
mysql_connect("", “”, “”) or die(mysql_error());
mysql_select_db("") or die(mysql_error());
//Get PlayerID from URL
$iPlayerID = $_GET[“PlayerID”];
$iNationID = $_GET[“NationID”];
$oPlayerInfo = mysql_query("
SELECT Players.PlayerID, Players.FirstName, Players.LastName, Players.Position, Players.Height, Players.Weight, Players.DOB, CNGHLTeams.CNGHLRights, NHLTeams.Team, Players.CNDraftYR, DraftTeam.DraftID, Players.CNDraftPOS, Countries.Nation, Players.NationID, DraftTeam.DrTeam
FROM Players
Left JOIN CNGHLTeams
ON Players.CNGHLID=CNGHLTeams.CNGHLID
Left JOIN NHLTeams
ON Players.TeamsID=NHLTeams.TeamID
Left JOIN Countries
ON Players.NationID=Countries.NationID
Left JOIN DraftTeam
ON Players.DraftID=DraftTeam.DraftID
WHERE Players.PlayerID=$iPlayerID
ORDER BY Players.LastName;
") or die(mysql_error());
while($row = mysql_fetch_array($oPlayerInfo))
{
Print “”;
Print “
”.$row[‘FirstName’]." “.$row[‘LastName’].” | ";||
Birthdate:”.$row[‘DOB’]." | ";Age: “.$age_cal->y;” | ”;<img src=“http://www.cnghl.biz/cnghldb/images/".$iPlayerID.".jpg">"; Print “ |
Nation:”.$row[‘Nation’].” | ”;CNGHL Team:”.$row[‘CNGHLRights’]. “ | ”;|
Position:”.$row[‘Position’]. “ | ”;Weight:”.$row[‘Weight’]. “ | ”;|
Height:”.$row[‘Height’]. “ | ”;NHL Team:”.$row[‘Team’]. “ | ”;|
Draft Year:”.$row[‘CNDraftYR’]." | ";Draft Position:”.$row[‘CNDraftPOS’]." | ";|
Drafted By: “.$row[‘DrTeam’].” | ”;"; | |
"; |
Print “”;
}
$oPlayerStats = mysql_query("
SELECT SeasonStats.Sea, SeasonStats.TeamID, SeasonStats.GP, SeasonStats.Goals,
SeasonStats.Assists, SeasonStats.Points, SeasonStats.PlusMinus,
SeasonStats.Pim, SeasonStats.PP, SeasonStats.SH, SeasonStats.GW,
SeasonStats.GT, SeasonStats.S, Seasonteam.Team, SeasonStats.SubSeason
FROM SeasonStats
Left JOIN Seasonteam
On SeasonStats.TeamID=Seasonteam.TeamID
WHERE SeasonStats.PlayerID=$iPlayerID
ORDER BY SeasonStats.Sea ASC,SeasonStats.SubSeason ASC;
") or die(mysql_error());
Print ‘’;
Print “
Season | ";Team | ";GP | ";G | ";A | ";P | ";PIM | ";+/- | ";PPG | ";SHG | ";GWG | ";GTG | ";Shots | ";
”.$row[‘Sea’]." | “;”.$row[‘Team’].” | “;”.$row[‘GP’].” | “;”.$row[‘Goals’].” | “;”.$row[‘Assists’].” | “;”.$row[‘Points’].” | “;”.$row[‘Pim’].” | “;”.$row[‘PlusMinus’].” | “;”.$row[‘PP’].” | “;”.$row[‘SH’].” | “;”.$row[‘GW’].” | “;”.$row[‘GT’].” | “;”.$row[‘S’].” | ";
$oPlayerStats = mysql_query("
SELECT SeasonStats.Sea, SeasonStats.TeamID, SeasonStats.GP, SeasonStats.Goals,
SeasonStats.Assists, SeasonStats.Points, SeasonStats.PlusMinus,
SeasonStats.Pim, SeasonStats.PP, SeasonStats.SH, SeasonStats.GW,
SeasonStats.GT, SeasonStats.S, Seasonteam.Team, SUM(SeasonStats.Goals) AS Goals_Total, SUM(SeasonStats.Assists) AS Assists_Total, SUM(SeasonStats.GP) As Games_Total, SUM(SeasonStats.Points) AS Points_Total, SUM(SeasonStats.Pim) AS Penalty_Total, SUM(SeasonStats.PlusMinus) AS PlusMinus_Total, SUM(SeasonStats.PP) AS Powerplay_Total, SUM(SeasonStats.SH) AS SH_Total, SUM(SeasonStats.GW) AS GW_Total, SUM(SeasonStats.GT) AS GT_Total, SUM(SeasonStats.S) AS Shots_Total
FROM SeasonStats
Left JOIN Seasonteam
On SeasonStats.TeamID=Seasonteam.TeamID
WHERE SeasonStats.PlayerID=$iPlayerID
ORDER BY SeasonStats.Sea
") or die(mysql_error());
Print “
Season | ";Team | ";GP | ";G | ";A | ";P | ";PIM | ";+/- | ";PPG | ";SHG | ";GWG | ";GTG | ";Shots | ";
”.$row[’-’]." | “;”.$row[’-’].” | “;”.$row[‘Games_Total’].” | “;”.$row[‘Goals_Total’].” | “;”.$row[‘Assists_Total’].” | “;”.$row[‘Points_Total’].” | “;”.$row[‘Penalty_Total’].” | “;”.$row[‘PlusMinus_Total’].” | “;”.$row[‘Powerplay_Total’].” | “;”.$row[‘SH_Total’].” | “;”.$row[‘GW_Total’].” | “;”.$row[‘GT_Total’].” | “;”.$row[‘Shots_Total’].” | “;
Print “
”;
$oPlayerTrans = mysql_query(”
SELECT Transtype.Transtype, TransFrom.TransFrom, TransTo.TransTo, Transactions.Transdate, Transactions.Transtime, Transactions.Season, Players.PlayerID
FROM Transtype
LEFT JOIN TransTo
LEFT JOIN TransFrom
LEFT JOIN Players
LEFT JOIN Transactions
ON Players.PlayerID = Transactions.PlayerID
ON TransFrom.TransFromID = Transactions.TransFromID
ON TransTo.TransToID = Transactions.TransToID
ON Transtype.TranstypeID = Transactions.TranstypeID
WHERE Players.PlayerID=$iPlayerID
ORDER BY Transactions.Transdate;
;
") or die(mysql_error ());
Print ‘

Print “
Type of Transaction | ";From | ";To | ";Date | ";Season | “;||||||||
”.$row[‘Transtype’].” | “;”.$row[‘TransFrom’].” | “;”.$row[‘TransTo’].” | “;”.$row[‘Transdate’].” | “;”.$row[‘Season’].” | ";}
Season | ";Lenght | ";$ | ";Team | “;
”.$row[‘Season’].” | “;”.$row[‘ContractL’].” | ";$ “.$unitcost.” | “;”.$row[‘Team’].” | ";}