How's everyone outputting team transactions and team/league leaders?
I'm trying to build a PHP site using the SQLite database and I haven't found a good way to query the database to pull team transactions. I've gotten it to the point where it will out put TRADE : From $TeamName to Team2 : Player (OV). I've seen many sites just show the player/picks/money rather than just the line from the TeamLog table. Also it seems like with the SQLite database the TeamLog and LeagueLog only show the current days output? So if I'm trying to pull constant info from there it would be wiped away after each sim day?
Also I've had no luck being able to pull team/league leaders. I know I can use the ORDER BY command to hopefully get the top say Goal scorer but then how do I limit how many results I get back to say 10 rows (players)?
Once again, any help would be greatly appreciated.
Thanks,
Brandyn
Transactions & Team/League Leaders?
-
- New in Town / Le Ptit Nouveau
- Posts: 43
- Joined: Tue Jun 19, 2012 1:25 pm
Re: Transactions & Team/League Leaders?
je te donne une source pour t'aider dans tes démarches de défrichage. Pour tout ce qui concerne les requêtes à ta base de donnée (ce que tu places dans ton SQL pour aller chercher tes données) va lire ici: http://www.w3schools.com/php/php_mysql_select_limit.asp tu vas y trouver des exemples faciles pour tout ce qui concerne les requêtes mysql ou tu peux toujours taper dans google mysql limit ou peu importe ce que tu cherches.
Pour le PHP, cEst à dire le code qui va afficher ces données que tu es allé récupérer le manuel complet est là: https://secure.php.net/manual/fr/
encore là, tu peux faire la même chose et taper sur google PHP et ce que tu veux, il y a plein d'exemples de fonctions et autres que tu peux utiliser et transposer pour un site de hockey, la base demeure toujours la même!
bonne lecture!
Pour le PHP, cEst à dire le code qui va afficher ces données que tu es allé récupérer le manuel complet est là: https://secure.php.net/manual/fr/
encore là, tu peux faire la même chose et taper sur google PHP et ce que tu veux, il y a plein d'exemples de fonctions et autres que tu peux utiliser et transposer pour un site de hockey, la base demeure toujours la même!
bonne lecture!
-
- New in Town / Le Ptit Nouveau
- Posts: 43
- Joined: Tue Jun 19, 2012 1:25 pm
Re: Transactions & Team/League Leaders?
Not sure if it matters or not, but I'm actually trying to do this all without having to setup a SQL database rather just using the SQLite database. The LIMIT function seems to work. I'll start incorporating this and see what I get. I've tried Googling SQL commands but most of them don't seem to work with SQLite databases but this one does.
Any input on the Transaction part?
(Thank you Google Translator)
Thanks,
Brandyn
Any input on the Transaction part?
(Thank you Google Translator)
Thanks,
Brandyn
-
- New in Town / Le Ptit Nouveau
- Posts: 43
- Joined: Tue Jun 19, 2012 1:25 pm
Re: Transactions & Team/League Leaders?
I'm also trying to figure out how I would take this array ($PlayerNameQuery = $db->query("SELECT Name FROM PlayerInfo WHERE TeamName = '$TeamName'"); while ($row3 = $PlayerNameQuery ->fetchArray())) which gets the player name based on the team name and compare it to the PlayerProStat table to get Goals/Assist/Points/etc.?
Nevermind...I got this part.
Nevermind...I got this part.
Last edited by Bmoney0313 on Thu Sep 17, 2015 3:16 pm, edited 1 time in total.
-
- New in Town / Le Ptit Nouveau
- Posts: 43
- Joined: Tue Jun 19, 2012 1:25 pm
Re: Transactions & Team/League Leaders?
It's too bad the PlayerProStat table doesn't have TeamNumber or TeamName as a column that would have made this much easier. Trying to get the roster from PlayerInfo based on TeamName or TeamNumber then taking that to PlayerProStat is a pain. I was able to pull back data now but I can't figure out how to pull back the top 5 based on the stat. I've tried ORDER BY G DESC but that's not working. It's just outputting the first 5 (LIMIT 5 is set) players from the team in the order they appear in the PlayerInfo table.
-
- STHS Owner / Propriétaire du STHS
- Posts: 14784
- Joined: Sat Oct 08, 2005 4:18 pm
- Location: Montreal, Canada
- Contact:
Re: Transactions & Team/League Leaders?
I think the query to get a limit number of result by order of Poiint is this :
SELECT Number, Name, P FROM PlayerProStat Order BY P DESC LIMIT 10
SELECT Number, Name, P FROM PlayerProStat Order BY P DESC LIMIT 10
-SimonT
Forum Administrator / Administrateur du Forum
STHS Owner / Propriètaire du STHS
English V2 & V3 Manual - Manuel V2 & V3 Français
Forum Administrator / Administrateur du Forum
STHS Owner / Propriètaire du STHS
English V2 & V3 Manual - Manuel V2 & V3 Français
-
- New in Town / Le Ptit Nouveau
- Posts: 43
- Joined: Tue Jun 19, 2012 1:25 pm
Re: Transactions & Team/League Leaders?
The problem is querying PlayerInfo for TeamNumber/Name then using that array against PlayerProStat. I'm just not sure how to do that and limit the array to say 5 results (players).
-
- STHS Owner / Propriétaire du STHS
- Posts: 14784
- Joined: Sat Oct 08, 2005 4:18 pm
- Location: Montreal, Canada
- Contact:
Re: Transactions & Team/League Leaders?
You want the Team Leader?
-SimonT
Forum Administrator / Administrateur du Forum
STHS Owner / Propriètaire du STHS
English V2 & V3 Manual - Manuel V2 & V3 Français
Forum Administrator / Administrateur du Forum
STHS Owner / Propriètaire du STHS
English V2 & V3 Manual - Manuel V2 & V3 Français
-
- STHS Owner / Propriétaire du STHS
- Posts: 14784
- Joined: Sat Oct 08, 2005 4:18 pm
- Location: Montreal, Canada
- Contact:
Re: Transactions & Team/League Leaders?
Try this
SELECT PlayerInfo.Number, PlayerInfo.Name, PlayerInfo.Team, PlayerProStat.G, PlayerProStat.A, PlayerProStat.P FROM PlayerInfo INNER JOIN PlayerProStat ON PlayerInfo.Number = PlayerProStat.Number WHERE PlayerInfo.Team=2 Order BY P DESC LIMIT 10
SELECT PlayerInfo.Number, PlayerInfo.Name, PlayerInfo.Team, PlayerProStat.G, PlayerProStat.A, PlayerProStat.P FROM PlayerInfo INNER JOIN PlayerProStat ON PlayerInfo.Number = PlayerProStat.Number WHERE PlayerInfo.Team=2 Order BY P DESC LIMIT 10
-SimonT
Forum Administrator / Administrateur du Forum
STHS Owner / Propriètaire du STHS
English V2 & V3 Manual - Manuel V2 & V3 Français
Forum Administrator / Administrateur du Forum
STHS Owner / Propriètaire du STHS
English V2 & V3 Manual - Manuel V2 & V3 Français
-
- New in Town / Le Ptit Nouveau
- Posts: 43
- Joined: Tue Jun 19, 2012 1:25 pm
Re: Transactions & Team/League Leaders?
That works perfectly! I had no idea you could query multiple tables in one statement by doing TableName.Column. Thanks for the info Simon!