Let me start by thanking all of you for the service you guys provide to the community...... It is cool to get stuff figured out by others and be able to share it
Roster Page (modified) - As a direct response to a post, I will start a new topic to see if this is something that may be able to help others as well....
The Roster Page code that is written is really geared towards creating "team pages and positions" from member information
I think the basic premise of it will work, But I am trying to get it geared more towards a Fantasy soccer roster - There are other programs that do this, But I like the idea of incorporating SMF to do this to keep all site material fluid and matching
So that being said here is what it would consist of :
You would need to have a title to define positions (http://www.the-rota.com/?page=30 this example has things like Joint Chiefs of Staff, General, Private, etc..)
They would be Goalkeeper, Defender, Midfielder, Forward
I would need to have a form that you would input information into :
Name :
Position :
Team :
Nationality :
Salary:
And write this to some table so that you could change the team information (in case of trade ) and the player would move to whichever team and show up on that roster
I would need to be able to create as many of these as needed ( I may start with 12 but may need 14 soon)
They would be somehow tied to a "Team Roster" Page (see below)
River Plate Roster <------ Nice Header - Team name is not fixed it would be a variable
Goalkeepers <------ Nice header
Player<----- These could be tables
Player
Defenders <------ Nice header
Player
PLayer
Midfielders <------ Nice header
Player
Player
Forwards <------ Nice header
Player
Player
I would somehow need to be able to link these to a menu or create a block with links to see the links on the front page
Here is my site - I will be using this theme (default)
http://all-time-baseball.com/Final_Whistle/index.php
I hope this is enough to have someone be able to look at it - Let me know if I can offer anymore insight...... Thanks Again
QuoteI would need to be able to create as many of these as needed
I'm not sure what you mean by "these." Are you talking about teams? Or pages? Or something else?
You don't have to have a different script for each team. What you can do is use the URL to determine which team would be printed out. For example, assuming that your roster page is page 15, and you wanted to see the roster of the team called "xyz", your URL could be
http://all-time-baseball.com/Final_Whistle/index.php?page=15;team=xyz
It would then print out all of the information for the team xyz. If, however, you wanted to print out the info for team abc, you would use
http://all-time-baseball.com/Final_Whistle/index.php?page=15;team=abc
Does this make sense? :)
What information is there about the teams themselves, separate from the players? Do they have names? Owners? Home "playing fields"? (Obviously I know absolutely nothing about fantasy sports. :) ) I'm thinking that the best thing to do would be to have two tables -- a "teams" table and a "players" table, with a relationship between them on the team id.
The code is in this post (http://www.tinyportal.net/index.php?topic=23259.msg189391#msg189391).
QuoteI'm not sure what you mean by "these." Are you talking about teams? Or pages? Or something else?
this would be teams / or team pages - As a league expands I would need to add more teams (or pages) to accomodate
QuoteWhat information is there about the teams themselves, separate from the players? Do they have names? Owners? Home "playing fields"? (Obviously I know absolutely nothing about fantasy sports. ) I'm thinking that the best thing to do would be to have two tables -- a "teams" table and a "players" table, with a relationship between them on the team id.
Teams would have - Owner (maybe a short history "championships won (by year) and cups won (by cup & year) A name (Liverpool, Chelsea, Real Madrid etc....) and a Stadium Name
Players would have: Name (needs to be a long field - Some Brazilian players have LOOOOOONG names), Position, Nationality (if a flag could show with this field that would be real awesome)
http://en.wikipedia.org/wiki/Club_Atl%C3%A9tico_River_Plate (see bottom of page)
and a salary (contract amount)....
I guess I could set this up in pages like you mentioned but would like to be able to move players from roster to roster and have them rebuilt automatically rather than manually changing pages...
Thanks
sec
Oh, no. I don't think you should set it up in pages at all. It's much better to do it with a database. I'm just trying to work out the fields that should be in tables. It's a whole lot easier for me to do these things up front. I've been working with helping folks create databases for over a decade, using several different types of scripts. I've found that it always happens that as soon as I get it done, the person wants to add "just one more thing." :) It seems to the user that this would be something simple, but often it means starting the whole thing over from scratch, so that the first effort I put into it is completely wasted effort.
So.... my point in asking all of these questions in an attempt to get it right the first time. :)
At this point, I've got three tables planned:
Team
----
team_id (key) autoincrement
teamOwner
teamName
teamStadium
Player
------
player_id (key) autoincrement
team_id ---------------------> Team table
playerName
playerPosition
playerNationality
playerSalary
Award
-----
award_id (key) autoincrement
team_id ---------------------> Team table
awardType (championship or type of cup)
year
Is that all of the information you need to have?
Well Maybe 3 more fields
Player
Career Goals Scored
Career Assists
Career Clean Sheets
That would be all I would need - And I won't change it, Thanks for the questions upfront and the assistance
Tony
"Clean Sheets"? They do laundry? :2funny: ;) (No need to explain. I know it doesn't have anything to do with laundry.)
Okay. I'll work on it a bit and post here when I come up with something.
Thank You very much.......
A couple of questions ---
Do you want a drop-down select field for the Nationality? It will ensure that the spelling is correct for each one. If so, which countries do you want to start with? You can add more later, if you need to.
Who can add or edit teams, players and awards? Only admin? Only moderators? Everybody?
Drop Down would be great..... Argentina, England, Spain (as long as I can add more this will be fine)
All editing can be done only by admin
Oh, yeah. No problem with adding more countries. Just follow the pattern in the code. You can also use flag images.
I'm getting there. I've got forms for adding teams, players and awards. The rest of it shouldn't be too hard, but I probably won't have it for you until tomorrow or Sunday.
Excellent.... No hurry - As you can is fine
I appreciate it
I have something that you can look at to be sure this is what you want.
http://www.jpdeni.com/snippets/index.php?page=8&team=1
I'm sure those statistics are way off, but I just had to put something in there. :)
I still have to write the code for editing stuff. Do you want the awards (championships and cups) for the team to be displayed on the top of the roster?
Those are excellent... Very well done
The awards should be at the top of the page -
Thanks much - looking forward to seeing the finished product
Thank you for the endevor
Cool! I just wanted to be sure we were on the same "page". ;)
I'll probably have this finished some time tomorrow.
Again ... Thanks for all of the work - Looking forward to seeing it
Best laid plans... :)
Migraine hit. It's better today.
A couple more questions... Can awards only be won by one team? For example, I'm assuming that there is only one winner of the 2007 Championship and 2006 World Cup. Is my assumption correct?
Do you need to be able to delete teams or players? Do you need to have players' names alphabetized by last name?
I've done a bit of adjusting on the printout.
Sorry about Migrane (they are a pain - pardon the pun) glad you are up and about again
QuoteA couple more questions... Can awards only be won by one team? For example, I'm assuming that there is only one winner of the 2007 Championship and 2006 World Cup. Is my assumption correct?
There will be 1 Champion per Division (Division 1 - Division 2) per year
There will only be 1 cup winner per year
Yes you are correct
QuoteDo you need to be able to delete teams or players? Do you need to have players' names alphabetized by last name?
This is the tricky one - Players may get released from teams so they no longer appear on a roster BUT once their name is in the DB it would be great if they did not have to be re-created just re-used should they get put on another team (as they will have career stats that would be a pain to re-create from memory) - Does that make sense ?
And last name would be great....
Thanks
Finally!!
Give this a try:
global $db_prefix, $scripturl, $user_info, $settings;
$positions = array('Goalkeeper','Defender','Midfielder','Forward');
//Add more countries here. Don't worry about them being in alphabetical order.
//For abbreviations see http://www.checkdomain.com/list.html or the install.xml file in the "Country Flags" mod
$countries = array (
'ar' => 'Argentina',
'es' => 'Spain',
'uk' => 'England',
);
//Use the .png flag images from the "Country Flags" mod -- http://custom.simplemachines.org/mods/index.php?mod=417
//The flag images should go into /Themes/default/images/flags/ -- If you put them somewhere else, enter the URL to the folder here
$flag_dir = $settings['default_theme_url'] . '/images/flags/';
// Create database tables
// You can delete this next bit after you run it once
//////////////////////////////////////////////////////
//////////////////////////////////////////////////////
db_query("CREATE TABLE IF NOT EXISTS {$db_prefix}jpd_fanteams (
`team_id` INT( 11 ) NOT NULL AUTO_INCREMENT ,
`teamOwner` TINYTEXT NOT NULL ,
`teamOwnerID` INT( 11 ) NOT NULL DEFAULT '0',
`teamName` TINYTEXT NOT NULL ,
`teamStadium` TINYTEXT NOT NULL ,
PRIMARY KEY ( `team_id` )
) ENGINE = MYISAM", __FILE__, __LINE__);
db_query("CREATE TABLE IF NOT EXISTS {$db_prefix}jpd_fanplayers (
`player_id` INT( 11 ) NOT NULL AUTO_INCREMENT ,
`team_id` INT( 11 ) NOT NULL DEFAULT '0',
`playerFName` TINYTEXT NOT NULL ,
`playerLName` TINYTEXT NOT NULL ,
`playerPosition` TINYTEXT NOT NULL ,
`playerNationality` TINYTEXT NOT NULL ,
`playerSalary` TINYTEXT NOT NULL ,
`playerGoals` INT( 3 ) NOT NULL DEFAULT '0',
`playerAssists` INT( 3 ) NOT NULL DEFAULT '0',
`playerCleanSheets` INT( 3 ) NOT NULL DEFAULT '0',
PRIMARY KEY ( `player_id` )
) ENGINE = MYISAM", __FILE__, __LINE__);
db_query("CREATE TABLE IF NOT EXISTS {$db_prefix}jpd_fanawards (
`award_id` INT( 11 ) NOT NULL AUTO_INCREMENT ,
`team_id` INT( 11 ) NOT NULL DEFAULT '0',
`awardType` TINYTEXT NOT NULL ,
`awardYear` INT( 4 ) NOT NULL DEFAULT '0',
PRIMARY KEY ( `award_id` )
) ENGINE = MYISAM", __FILE__, __LINE__);
//////////////////////////////////////////////////////
//////////////////////////////////////////////////////
$teams = array();
$query = db_query(
"SELECT team_id,teamName
FROM {$db_prefix}jpd_fanteams
ORDER BY teamName", __FILE__, __LINE__);
while ($row = mysql_fetch_assoc($query))
$teams[$row['team_id']] = $row['teamName'];
$page = $_GET['page'];
$printed = 0;
//**Add/Edit team form
if ((isset($_GET['addteam']) || isset($_GET['editteam'])) && $user_info['is_admin']) {
if (isset($_GET['addteam'])) {
$teamowner = "";
$teamname = "";
$teamstadium = "";
$submit = "Add Team";
$hidden = "addteam";
$teamid = "";
}
else {
$team = $_GET['team'];
$query = db_query(
"SELECT *
FROM {$db_prefix}jpd_fanteams
WHERE team_id LIKE $team", __FILE__, __LINE__);
$row = mysql_fetch_assoc($query);
$teamowner = $row['teamOwner'];
$teamname = $row['teamName'];
$teamstadium = $row['teamStadium'];
$teamid = $row['team_id'];
$submit = "Edit Team";
$hidden = "editteam";
}
echo '<form action="' . $scripturl . '?page=' . $page . '" method="POST">';
echo '<center><table>
<input type="hidden" name="' . $hidden . '" value="2">
<input type="hidden" name="teamid" value="' . $teamid . '">
<tr><td align="right">Team Owner:</td>
<td align="left"><input type="text" name="teamOwner" value="' . $teamowner . '"></td></tr>
<tr><td align="right">Team Name:</td>
<td align="left"><input type="text" name="teamName" value="' . $teamname . '"></td></tr>
<tr><td align="right">Team Stadium:</td>
<td align="left"><input type="text" name="teamStadium" value="' . $teamstadium . '"></td></tr>
<tr><td colspan="2" align="center"><INPUT type="submit" name="team" value="' . $submit . '"></td></tr>';
echo '</table></center></form>';
$printed = 1;
}
// Add team to database
elseif (isset($_POST['addteam']) && $_POST['addteam'] == 2 && $user_info['is_admin']) {
$teamOwner = $_POST['teamOwner'];
$teamName = $_POST['teamName'];
$teamStadium = $_POST['teamStadium'];
$query = db_query(
"SELECT ID_MEMBER
FROM {$db_prefix}members
WHERE realName LIKE '$teamOwner'
LIMIT 1", __FILE__, __LINE__);
$row = mysql_fetch_assoc($query);
$teamOwnerID = $row['ID_MEMBER'];
db_query("INSERT INTO `{$db_prefix}jpd_fanteams`
(team_id,teamOwner,teamOwnerID,teamName,teamStadium)
VALUES (NULL, '$teamOwner', '$teamOwnerID', '$teamName', '$teamStadium')", __FILE__, __LINE__);
}
//**Update team in database
elseif (isset($_POST['editteam']) && $_POST['editteam'] == 2 && $user_info['is_admin']) {
$teamOwner = $_POST['teamOwner'];
$teamName = $_POST['teamName'];
$teamStadium = $_POST['teamStadium'];
$team_id = $_POST['teamid'];
$query = db_query(
"SELECT ID_MEMBER
FROM {$db_prefix}members
WHERE realName LIKE '$teamOwner'
LIMIT 1", __FILE__, __LINE__);
$row = mysql_fetch_assoc($query);
$teamOwnerID = $row['ID_MEMBER'];
db_query("UPDATE `{$db_prefix}jpd_fanteams`
SET `teamOwner` = '$teamOwner' , `teamOwnerID` = '$teamOwnerID',
`teamName` = '$teamName', `teamStadium` = '$teamStadium'
WHERE `team_id` =$team_id", __FILE__, __LINE__);
}
//**Add/Edit award form
if ((isset($_GET['addaward']) || isset($_GET['editaward'])) && $user_info['is_admin']) {
if (isset($_GET['addaward'])) {
$team_id = '';
$awardType = '';
$awardYear = '';
$award_id = '';
$submit = "Add award";
$hidden = "addaward";
}
else {
$award_id = $_GET['award'];
$query = db_query(
"SELECT *
FROM {$db_prefix}jpd_fanawards
WHERE award_id LIKE $award_id", __FILE__, __LINE__);
$row = mysql_fetch_assoc($query);
$team_id = $row['team_id'];
$awardType = $row['awardType'];
$awardYear = $row['awardYear'];
$submit = "Edit award";
$hidden = "editaward";
}
echo '<form action="' . $scripturl . '?page=' . $page . '" method="POST">';
echo '<center><table>
<input type="hidden" name="' . $hidden . '" value="2">
<input type="hidden" name="award_id" value="' . $award_id . '">
<tr><td align="right">Team:</td>
<td align="left"><select name="team_id">
<option value=""> </option>';
foreach ($teams as $key => $team) {
echo '<option value="' . $key . '"';
if ($team_id == $key)
echo ' SELECTED ';
echo '>' . $team . '</option>';
}
echo '</select>';
echo '</td></tr>
<tr><td align="right">Award Type:</td>
<td align="left"><input type="text" name="awardType" value="' . $awardType . '"></td></tr>
<tr><td align="right">Year:</td>
<td align="left"><input type="text" name="awardYear" value="' . $awardYear . '" size="4"></td></tr>
<tr><td colspan="2" align="center"><INPUT type="submit" name="award" value="' . $submit . '"></td></tr>';
echo '</table></center></form>';
$printed = 1;
}
// Add award to database
elseif (isset($_POST['addaward']) && $_POST['addaward'] == 2 && $user_info['is_admin']) {
$team_id = $_POST['team_id'];
$awardType = $_POST['awardType'];
$awardYear = $_POST['awardYear'];
db_query("INSERT INTO `{$db_prefix}jpd_fanawards`
(award_id,team_id,awardType,awardYear)
VALUES (NULL, '$team_id', '$awardType', '$awardYear')", __FILE__, __LINE__);
}
//**Update an award in the database
elseif (isset($_POST['editaward']) && $_POST['editaward'] == 2 && $user_info['is_admin']) {
$award_id = $_POST['award_id'];
$team_id = $_POST['team_id'];
$awardType = $_POST['awardType'];
$awardYear = $_POST['awardYear'];
db_query("UPDATE `{$db_prefix}jpd_fanawards`
SET `award_id` = '$award_id', `team_id` = '$team_id', `awardType` = '$awardType', `awardYear` = '$awardYear'
WHERE `award_id` =$award_id", __FILE__, __LINE__);
}
//**Add/Edit player form
if ((isset($_GET['addplayer']) || isset($_GET['editplayer'])) && $user_info['is_admin']) {
if (isset($_GET['addplayer'])) {
$player_id = "";
$team_id = "";
$playerFName = "";
$playerLName = "";
$playerPosition = "";
$playerNationality = "";
$playerSalary = "";
$playerGoals = "";
$playerAssists = "";
$playerCleanSheets = "";
$submit = "Add Player";
$hidden = "addplayer";
}
else {
$player_id = $_GET['player'];
$query = db_query(
"SELECT *
FROM {$db_prefix}jpd_fanplayers
WHERE player_id LIKE $player_id", __FILE__, __LINE__);
$row = mysql_fetch_assoc($query);
$team_id = $row['team_id'];
$playerFName = $row['playerFName'];
$playerLName = $row['playerLName'];
$playerPosition = $row['playerPosition'];
$playerNationality = $row['playerNationality'];
$playerSalary = $row['playerSalary'];
$playerGoals = $row['playerGoals'];
$playerAssists = $row['playerAssists'];
$playerCleanSheets = $row['playerCleanSheets'];
$submit = "Edit Player";
$hidden = "editplayer";
}
echo '<form action="' . $scripturl . '?page=' . $page . '" method="POST">';
echo '<center><table>
<input type="hidden" name="' . $hidden . '" value="2">
<input type="hidden" name="player_id" value="' . $player_id . '">
<tr><td align="right">Player Name:</td>
<td align="left"><input type="text" name="playerFName" value="' . $playerFName . '"> <input type="text" name="playerLName" value="' . $playerLName . '"></td></tr>
<tr><td align="right">Team:</td>
<td align="left"><select name="team_id">
<option value=""> </option>';
foreach ($teams as $key => $team) {
echo '<option value="' . $key . '"';
if ($team_id == $key)
echo ' SELECTED ';
echo '>' . $team . '</option>';
}
echo '</select>';
echo '</td></tr>
<tr><td align="right">Position:</td>
<td align="left"><select name="playerPosition">';
foreach ($positions as $position) {
echo '<option';
if ($playerPosition == $position)
echo ' SELECTED ';
echo '>' . $position . '</option>';
}
echo '</select>';
echo '</td></tr>
<tr><td align="right">Nationality:</td>
<td align="left"><select name="playerNationality">';
asort($countries);
foreach ($countries as $key => $country) {
echo '<option value="' . $key . '"';
if ($playerNationality == $key)
echo ' SELECTED ';
echo '>' . $country . '</option>';
}
echo '</select>';
echo '</td></tr>
<tr><td align="right">Salary:</td>
<td align="left">$<input type="text" name="playerSalary" value="' . $playerSalary . '"></td></tr>
<tr><td align="right">Career Number of Goals:</td>
<td align="left"><input type="text" name="playerGoals" value="' . $playerGoals . '" size="3"></td></tr>
<tr><td align="right">Career Number of Assists:</td>
<td align="left"><input type="text" name="playerAssists" value="' . $playerAssists . '" size="3"></td></tr>
<tr><td align="right">Career Number of Clean Sheets:</td>
<td align="left"><input type="text" name="playerCleanSheets" value="' . $playerCleanSheets . '" size="3"></td></tr>
<tr><td colspan="2" align="center"><INPUT type="submit" name="team" value="' . $submit . '"></td></tr>';
echo '</table></center></form>';
$printed = 1;
}
// Add player to database
elseif (isset($_POST['addplayer']) && $_POST['addplayer'] == 2 && $user_info['is_admin']) {
$team_id = $_POST['team_id'];
$playerName = $_POST['playerName'];
$playerPosition = $_POST['playerPosition'];
$playerNationality = $_POST['playerNationality'];
$playerSalary = $_POST['playerSalary'];
$playerGoals = $_POST['playerGoals'];
$playerAssists = $_POST['playerAssists'];
$playerCleanSheets = $_POST['playerCleanSheets'];
db_query("INSERT INTO `{$db_prefix}jpd_fanplayers`
(player_id,team_id,playerFName,playerLName,playerPosition,playerNationality,playerSalary,playerGoals,playerAssists,playerCleanSheets)
VALUES (NULL, '$team_id', '$playerFName', '$playerLName', '$playerPosition', '$playerNationality', '$playerSalary', '$playerGoals', '$playerAssists', '$playerCleanSheets')", __FILE__, __LINE__);
}
//**Update player in database
elseif (isset($_POST['editplayer']) && $_POST['editplayer'] == 2 && $user_info['is_admin']) {
$player_id = $_POST['player_id'];
$team_id = $_POST['team_id'];
$playerFName = $_POST['playerFName'];
$playerLName = $_POST['playerLName'];
$playerPosition = $_POST['playerPosition'];
$playerNationality = $_POST['playerNationality'];
$playerSalary = $_POST['playerSalary'];
$playerGoals = $_POST['playerGoals'];
$playerAssists = $_POST['playerAssists'];
$playerCleanSheets = $_POST['playerCleanSheets'];
db_query("UPDATE `{$db_prefix}jpd_fanplayers`
SET `player_id` = '$player_id', `team_id` = '$team_id', `playerFName` = '$playerFName', `playerLName` = '$playerLName',`playerPosition` = '$playerPosition',
`playerNationality` = '$playerNationality', `playerSalary` = '$playerSalary', `playerGoals` = '$playerGoals',
`playerAssists` = '$playerAssists', `playerCleanSheets` = '$playerCleanSheets'
WHERE `player_id` =$player_id", __FILE__, __LINE__);
}
//**Display a team's roster
elseif (isset($_GET['team']) && !isset($_GET['editteam'])) {
$team = $_GET['team'];
$awards = array();
$query = db_query(
"SELECT *
FROM {$db_prefix}jpd_fanteams
WHERE team_id LIKE '$team'", __FILE__, __LINE__);
$row = mysql_fetch_assoc($query);
$teamowner = '<a href="' . $scripturl . '?action=profile;u=' . $row['teamOwnerID'] . '">' . $row['teamOwner'] . '</a>';
$teamstadium = $row['teamStadium'];
$query = db_query(
"SELECT *
FROM {$db_prefix}jpd_fanplayers
WHERE team_id LIKE '$team'
ORDER BY playerLName", __FILE__, __LINE__);
while ($row = mysql_fetch_assoc($query)) {
$roster[$row['playerPosition']][$row['player_id']]['name'] = $row['playerFName'] . ' ' . $row['playerLName'];
$roster[$row['playerPosition']][$row['player_id']]['nationality'] = '<img src="' . $flag_dir . $row['playerNationality'] . '.png" alt="' . $countries[$row['playerNationality']] . '" />';
$roster[$row['playerPosition']][$row['player_id']]['salary'] = $row['playerSalary'];
$roster[$row['playerPosition']][$row['player_id']]['goals'] = $row['playerGoals'];
$roster[$row['playerPosition']][$row['player_id']]['assists'] = $row['playerAssists'];
$roster[$row['playerPosition']][$row['player_id']]['cleansheets'] = $row['playerCleanSheets'];
}
$query = db_query(
"SELECT *
FROM {$db_prefix}jpd_fanawards
WHERE team_id LIKE '$team'
ORDER BY awardYear,awardType", __FILE__, __LINE__);
while ($row = mysql_fetch_assoc($query))
$awards[] = '<tr><td>' . $row['awardYear'] . '</td><td align="left">' . $row['awardType'] . '</td></tr>';
echo '<table width="100%">
<tr><td colspan="6" align="center" class="catbg" style="font-size: 120%;">' . $teams[$team];
echo '<table><tr><td width="17%" align="right">Owner:</td><td width="16%" align="left">'. $teamowner . '</td><td width="34%">';
echo '<table>';
foreach ($awards as $award)
echo $award;
echo '</table>';
echo '</td><td width="17%" align="right">Stadium:</td><td width="16%" align="left">'. $teamstadium . '</td></tr></table>';
echo '</td></tr>';
foreach ($positions as $position) {
echo '<tr><td colspan="6" align="left" class="titlebg">' . $position . '</td></tr>';
echo '<tr class="windowbg"><td align="center">Name</td>
<td align="center">Nationality</td>
<td align="center">Salary</td>
<td align="center">Career Goals</td>
<td align="center">Career Assists</td>
<td align="center">Career Clean Sheets</td></tr>';
if (isset($roster[$position])) {
foreach ($roster[$position] as $player) {
echo '<tr class="windowbg2">';
echo '<td align="center">' . $player['name'] . '</td>';
echo '<td align="center">' . $player['nationality'] . '</td>';
echo '<td align="center">$' . $player['salary'] . '</td>';
echo '<td align="center">' . $player['goals'] . '</td>';
echo '<td align="center">' . $player['assists'] . '</td>';
echo '<td align="center">' . $player['cleansheets'] . '</td>';
echo '</tr>';
}
}
}
echo '<tr><td colspan="6" align="center" class="catbg">&nb' . 'sp;</td></tr>';
echo '</table>';
$printed = 1;
}
if ($printed == 1) { echo '<hr />'; }
echo '<form action="' . $scripturl . '" method="GET">';
echo '<center><table>
<input type="hidden" name="page" value="' . $page . '">
<tr><td align="right">Which team' . "'" . 's roster<br />do you want to see?</td>
<td align="left"><select name="team">
<option value=""> </option>';
foreach ($teams as $key => $team)
echo '<option value="' . $key . '">' . $team . '</option>';
echo '</select>';
echo '</td></tr>
<tr><td colspan="2" align="center"><INPUT type="submit" name="go" value="Show Me"></td></tr>';
echo '</table></center></form>';
if ($user_info['is_admin']) {
echo '<table>';
// Add or edit team
echo '<form action="' . $scripturl . '" method="GET">
<input type="hidden" name="page" value="' . $page . '">
<tr><td align="right">Choose team to edit</td>
<td align="left"><select name="team">
<option value=""> </option>';
foreach ($teams as $key => $team)
echo '<option value="' . $key . '">' . $team . '</option>';
echo '</select>';
echo ' <INPUT type="submit" name="editteam" value="Edit"></td>
<td><INPUT type="submit" name="addteam" value="Add new team"></td></tr>';
echo '</form>';
//Add or edit player
echo '<form action="' . $scripturl . '" method="GET">';
echo '<input type="hidden" name="page" value="' . $page . '">
<tr><td align="right">Choose player to edit</td>
<td align="left"><select name="player">
<option value=""> </option>';
$query = db_query(
"SELECT *
FROM {$db_prefix}jpd_fanplayers
ORDER BY playerLName", __FILE__, __LINE__);
while ($row = mysql_fetch_assoc($query))
echo '<option value="' . $row['player_id'] . '">' . $row['playerFName'] . ' ' . $row['playerLName'] . '</option>';
echo '</select>';
echo ' <INPUT type="submit" name="editplayer" value="Edit"></td>
<td><INPUT type="submit" name="addplayer" value="Add new player"></td></tr>';
echo '</form>';
//Add or edit award
echo '<form action="' . $scripturl . '" method="GET">';
echo '<input type="hidden" name="page" value="' . $page . '">
<tr><td align="right">Choose award to edit</td>
<td align="left"><select name="award">
<option value=""> </option>';
$query = db_query(
"SELECT *
FROM {$db_prefix}jpd_fanawards
ORDER BY awardYear,awardType", __FILE__, __LINE__);
while ($row = mysql_fetch_assoc($query))
echo '<option value="' . $row['award_id'] . '">' . $row['awardYear'] . ' ' . $row['awardType'] . '</option>';
echo '</select>';
echo ' <INPUT type="submit" name="editaward" value="Edit"></td>
<td><INPUT type="submit" name="addaward" value="Add new award"></td></tr>';
echo '</form>';
echo '</table>';
}
It needs to go into a php article -- not a block. Notice the information about the flag images right at the beginning of the code.
Ok.. I pated it into a php article.... How does it get used ?.... Thanks Again
Take note of the page number for the article. Let's say it's page 8. Then go to
http://www.yourdomain.com/index.php?page=8
You'll see a dropdown list at the beginning, which won't have anything in it. Below that, since you're the admin, you'll see several forms for adding and editing teams, players and awards. Start by adding a team or several teams. Then add players. Add any awards that the teams have won.
It's really easiest just to take a look at it and do what seems logical. :)
Ok.. Got that working simple enough.... Where does it store (and how) the different rosters ?
Everything is stored in the database. Roughly in the same place as your forum posts, except in a different table.
To access a given roster, you need to add "team" and the number of the team to the URL.
So, let's say your page is page 8 and the first team you entered is "The Roughnecks". The URL to access the roster for The Roughnecks would be
http://www.yourdomain.com/index.php?page=8;team=1
If you don't have a team number in the URL, you just get the dropdown list of all the teams that have been entered into the database and people can choose from there. That dropdown is at the bottom of every page so that people can go from one roster to the other easily.
I can make you a block that has links to all the teams if you want. I'll just need to know which page number your article has.
sorry... posted in the wrong section..... :-\
Hi JPDeni,
Really nice work with this custom roster.
Any chance you can modify this code so that one can use it for managing an MMO guild isntead ?
I have edited your code a bit and this is what I got ;
http://www.skyline-mmo.eu/index.php?page=7&team=1&go=Show+Me
The part of your code that I changed was;
$positions = array('Bard','Beastmaster','Black Mage','Blue Mage','Corsair','Dancer','Dark Knight','Dragoon','Monk','Ninja','Paladin','Puppetmaster','Ranger','Red Mage','Samurai','Scholar','Summoner','Thief','Warrior','White Mage');
Now since this is a MMO game we dont need "teams" function anymore so that can be removed.
We also don't need to the award system, that can be removed as well. The only thing that would be needed is "Choose player to edit" "Add a player". I would like to call it "Member" instead of player though. That member should then pop under either of those classes in the array 'Bard','Beastmaster' etc.. depending on what was added when the "member" got registered.
Also instead of this code;
`playerFName` TINYTEXT NOT NULL ,
`playerLName` TINYTEXT NOT NULL ,
`playerPosition` TINYTEXT NOT NULL ,
`playerNationality` TINYTEXT NOT NULL ,
`playerSalary` TINYTEXT NOT NULL ,
`playerGoals` INT( 3 ) NOT NULL DEFAULT '0',
`playerAssists` INT( 3 ) NOT NULL DEFAULT '0',
`playerCleanSheets` INT( 3 ) NOT NULL DEFAULT '0',
I want to have
memberName ( No need for F and L )
memberClass = correspons to the $positions = array('Bard','etc...
memberNation = 3 to choose from San d'Oria, Windurst, Bastok
memberRank = Member, Officer, LS Leader
Is this doable ?
Most everything is doable. The only way you can know is to give it a try. At this point, you are much more familiar with this code than I am. It's been so long since I looked at it, I would have to start over from the beginning.
Quote from: JPDeni on July 07, 2009, 01:21:23 AM
Most everything is doable. The only way you can know is to give it a try. At this point, you are much more familiar with this code than I am. It's been so long since I looked at it, I would have to start over from the beginning.
I can wait np ^^ I have 0 skill in php or sql coding, so I don't really understand what I need to change ;D
Ok so I changed the code and removed what was not needed;
The original part;
global $db_prefix, $scripturl, $user_info, $settings;
$positions = array('Goalkeeper','Defender','Midfielder','Forward');
//Add more countries here. Don't worry about them being in alphabetical order.
//For abbreviations see http://www.checkdomain.com/list.html or the install.xml file in the "Country Flags" mod
$countries = array (
'ar' => 'Argentina',
'es' => 'Spain',
'uk' => 'England',
);
//Use the .png flag images from the "Country Flags" mod -- http://custom.simplemachines.org/mods/index.php?mod=417
//The flag images should go into /Themes/default/images/flags/ -- If you put them somewhere else, enter the URL to the folder here
$flag_dir = $settings['default_theme_url'] . '/images/flags/';
// Create database tables
// You can delete this next bit after you run it once
//////////////////////////////////////////////////////
//////////////////////////////////////////////////////
db_query("CREATE TABLE IF NOT EXISTS {$db_prefix}jpd_fanteams (
`team_id` INT( 11 ) NOT NULL AUTO_INCREMENT ,
`teamOwner` TINYTEXT NOT NULL ,
`teamOwnerID` INT( 11 ) NOT NULL DEFAULT '0',
`teamName` TINYTEXT NOT NULL ,
`teamStadium` TINYTEXT NOT NULL ,
PRIMARY KEY ( `team_id` )
) ENGINE = MYISAM", __FILE__, __LINE__);
db_query("CREATE TABLE IF NOT EXISTS {$db_prefix}jpd_fanplayers (
`player_id` INT( 11 ) NOT NULL AUTO_INCREMENT ,
`team_id` INT( 11 ) NOT NULL DEFAULT '0',
`playerFName` TINYTEXT NOT NULL ,
`playerLName` TINYTEXT NOT NULL ,
`playerPosition` TINYTEXT NOT NULL ,
`playerNationality` TINYTEXT NOT NULL ,
`playerSalary` TINYTEXT NOT NULL ,
`playerGoals` INT( 3 ) NOT NULL DEFAULT '0',
`playerAssists` INT( 3 ) NOT NULL DEFAULT '0',
`playerCleanSheets` INT( 3 ) NOT NULL DEFAULT '0',
PRIMARY KEY ( `player_id` )
) ENGINE = MYISAM", __FILE__, __LINE__);
db_query("CREATE TABLE IF NOT EXISTS {$db_prefix}jpd_fanawards (
`award_id` INT( 11 ) NOT NULL AUTO_INCREMENT ,
`team_id` INT( 11 ) NOT NULL DEFAULT '0',
`awardType` TINYTEXT NOT NULL ,
`awardYear` INT( 4 ) NOT NULL DEFAULT '0',
PRIMARY KEY ( `award_id` )
) ENGINE = MYISAM", __FILE__, __LINE__);
//////////////////////////////////////////////////////
//////////////////////////////////////////////////////
Changed into;
global $db_prefix, $scripturl, $user_info, $settings;
$positions = array('Bard','Beastmaster','Black Mage','Blue Mage','Corsair','Dancer','Dark Knight','Dragoon','Monk','Ninja','Paladin','Puppetmaster','Ranger','Red Mage','Samurai','Scholar','Summoner','Thief','Warrior','White Mage');
//Add more countries here. Don't worry about them being in alphabetical order.
//For abbreviations see http://www.checkdomain.com/list.html or the install.xml file in the "Country Flags" mod
$countries = array (
'sa' => 'San d'Oria',
'wi' => 'Windurst',
'ba' => 'Bastok',
);
//Use the .png flag images from the "Country Flags" mod -- http://custom.simplemachines.org/mods/index.php?mod=417
//The flag images should go into /Themes/default/images/flags/ -- If you put them somewhere else, enter the URL to the folder here
$flag_dir = $settings['default_theme_url'] . '/images/flags/';
// Create database tables
// You can delete this next bit after you run it once
//////////////////////////////////////////////////////
//////////////////////////////////////////////////////
db_query("CREATE TABLE IF NOT EXISTS {$db_prefix}jpd_members (
`member_id` INT( 11 ) NOT NULL AUTO_INCREMENT ,
`memberName` TINYTEXT NOT NULL ,
`memberClass` TINYTEXT NOT NULL ,
`memberNation` TINYTEXT NOT NULL ,
`memberRank` TINYTEXT NOT NULL ,
`memberLevel` TINYTEXT NOT NULL ,
PRIMARY KEY ( `member_id` )
) ENGINE = MYISAM", __FILE__, __LINE__);
//////////////////////////////////////////////////////
//////////////////////////////////////////////////////
Then this code follows;
$teams = array();
$query = db_query(
"SELECT team_id,teamName
FROM {$db_prefix}jpd_fanteams
ORDER BY teamName", __FILE__, __LINE__);
while ($row = mysql_fetch_assoc($query))
$teams[$row['team_id']] = $row['teamName'];
$page = $_GET['page'];
$printed = 0;
I didnt really know how to change this code, or if I need to add/remove :-\
After that:
//**Add/Edit team form
if ((isset($_GET['addteam']) || isset($_GET['editteam'])) && $user_info['is_admin']) {
if (isset($_GET['addteam'])) {
$teamowner = "";
$teamname = "";
$teamstadium = "";
$submit = "Add Team";
$hidden = "addteam";
$teamid = "";
}
else {
$team = $_GET['team'];
$query = db_query(
"SELECT *
FROM {$db_prefix}jpd_fanteams
WHERE team_id LIKE $team", __FILE__, __LINE__);
$row = mysql_fetch_assoc($query);
$teamowner = $row['teamOwner'];
$teamname = $row['teamName'];
$teamstadium = $row['teamStadium'];
$teamid = $row['team_id'];
$submit = "Edit Team";
$hidden = "editteam";
}
echo '<form action="' . $scripturl . '?page=' . $page . '" method="POST">';
echo '<center><table>
<input type="hidden" name="' . $hidden . '" value="2">
<input type="hidden" name="teamid" value="' . $teamid . '">
<tr><td align="right">Team Owner:</td>
<td align="left"><input type="text" name="teamOwner" value="' . $teamowner . '"></td></tr>
<tr><td align="right">Team Name:</td>
<td align="left"><input type="text" name="teamName" value="' . $teamname . '"></td></tr>
<tr><td align="right">Team Stadium:</td>
<td align="left"><input type="text" name="teamStadium" value="' . $teamstadium . '"></td></tr>
<tr><td colspan="2" align="center"><INPUT type="submit" name="team" value="' . $submit . '"></td></tr>';
echo '</table></center></form>';
$printed = 1;
}
// Add team to database
elseif (isset($_POST['addteam']) && $_POST['addteam'] == 2 && $user_info['is_admin']) {
$teamOwner = $_POST['teamOwner'];
$teamName = $_POST['teamName'];
$teamStadium = $_POST['teamStadium'];
$query = db_query(
"SELECT ID_MEMBER
FROM {$db_prefix}members
WHERE realName LIKE '$teamOwner'
LIMIT 1", __FILE__, __LINE__);
$row = mysql_fetch_assoc($query);
$teamOwnerID = $row['ID_MEMBER'];
db_query("INSERT INTO `{$db_prefix}jpd_fanteams`
(team_id,teamOwner,teamOwnerID,teamName,teamStadium)
VALUES (NULL, '$teamOwner', '$teamOwnerID', '$teamName', '$teamStadium')", __FILE__, __LINE__);
}
//**Update team in database
elseif (isset($_POST['editteam']) && $_POST['editteam'] == 2 && $user_info['is_admin']) {
$teamOwner = $_POST['teamOwner'];
$teamName = $_POST['teamName'];
$teamStadium = $_POST['teamStadium'];
$team_id = $_POST['teamid'];
$query = db_query(
"SELECT ID_MEMBER
FROM {$db_prefix}members
WHERE realName LIKE '$teamOwner'
LIMIT 1", __FILE__, __LINE__);
$row = mysql_fetch_assoc($query);
$teamOwnerID = $row['ID_MEMBER'];
db_query("UPDATE `{$db_prefix}jpd_fanteams`
SET `teamOwner` = '$teamOwner' , `teamOwnerID` = '$teamOwnerID',
`teamName` = '$teamName', `teamStadium` = '$teamStadium'
WHERE `team_id` =$team_id", __FILE__, __LINE__);
}
//**Add/Edit award form
if ((isset($_GET['addaward']) || isset($_GET['editaward'])) && $user_info['is_admin']) {
if (isset($_GET['addaward'])) {
$team_id = '';
$awardType = '';
$awardYear = '';
$award_id = '';
$submit = "Add award";
$hidden = "addaward";
}
else {
$award_id = $_GET['award'];
$query = db_query(
"SELECT *
FROM {$db_prefix}jpd_fanawards
WHERE award_id LIKE $award_id", __FILE__, __LINE__);
$row = mysql_fetch_assoc($query);
$team_id = $row['team_id'];
$awardType = $row['awardType'];
$awardYear = $row['awardYear'];
$submit = "Edit award";
$hidden = "editaward";
}
echo '<form action="' . $scripturl . '?page=' . $page . '" method="POST">';
echo '<center><table>
<input type="hidden" name="' . $hidden . '" value="2">
<input type="hidden" name="award_id" value="' . $award_id . '">
<tr><td align="right">Team:</td>
<td align="left"><select name="team_id">
<option value=""> </option>';
foreach ($teams as $key => $team) {
echo '<option value="' . $key . '"';
if ($team_id == $key)
echo ' SELECTED ';
echo '>' . $team . '</option>';
}
echo '</select>';
echo '</td></tr>
<tr><td align="right">Award Type:</td>
<td align="left"><input type="text" name="awardType" value="' . $awardType . '"></td></tr>
<tr><td align="right">Year:</td>
<td align="left"><input type="text" name="awardYear" value="' . $awardYear . '" size="4"></td></tr>
<tr><td colspan="2" align="center"><INPUT type="submit" name="award" value="' . $submit . '"></td></tr>';
echo '</table></center></form>';
$printed = 1;
}
// Add award to database
elseif (isset($_POST['addaward']) && $_POST['addaward'] == 2 && $user_info['is_admin']) {
$team_id = $_POST['team_id'];
$awardType = $_POST['awardType'];
$awardYear = $_POST['awardYear'];
db_query("INSERT INTO `{$db_prefix}jpd_fanawards`
(award_id,team_id,awardType,awardYear)
VALUES (NULL, '$team_id', '$awardType', '$awardYear')", __FILE__, __LINE__);
}
//**Update an award in the database
elseif (isset($_POST['editaward']) && $_POST['editaward'] == 2 && $user_info['is_admin']) {
$award_id = $_POST['award_id'];
$team_id = $_POST['team_id'];
$awardType = $_POST['awardType'];
$awardYear = $_POST['awardYear'];
db_query("UPDATE `{$db_prefix}jpd_fanawards`
SET `award_id` = '$award_id', `team_id` = '$team_id', `awardType` = '$awardType', `awardYear` = '$awardYear'
WHERE `award_id` =$award_id", __FILE__, __LINE__);
}
I removed all this since we don't need teams or awards.
Next in line;
//**Add/Edit player form
if ((isset($_GET['addplayer']) || isset($_GET['editplayer'])) && $user_info['is_admin']) {
if (isset($_GET['addplayer'])) {
$player_id = "";
$team_id = "";
$playerFName = "";
$playerLName = "";
$playerPosition = "";
$playerNationality = "";
$playerSalary = "";
$playerGoals = "";
$playerAssists = "";
$playerCleanSheets = "";
$submit = "Add Player";
$hidden = "addplayer";
}
else {
$player_id = $_GET['player'];
$query = db_query(
"SELECT *
FROM {$db_prefix}jpd_fanplayers
WHERE player_id LIKE $player_id", __FILE__, __LINE__);
$row = mysql_fetch_assoc($query);
$team_id = $row['team_id'];
$playerFName = $row['playerFName'];
$playerLName = $row['playerLName'];
$playerPosition = $row['playerPosition'];
$playerNationality = $row['playerNationality'];
$playerSalary = $row['playerSalary'];
$playerGoals = $row['playerGoals'];
$playerAssists = $row['playerAssists'];
$playerCleanSheets = $row['playerCleanSheets'];
$submit = "Edit Player";
$hidden = "editplayer";
}
I changed into;
//**Add/Edit member form
if ((isset($_GET['addmember']) || isset($_GET['editmember'])) && $user_info['is_admin']) {
if (isset($_GET['addmember'])) {
$member_id = "";
$memberName = "";
$memberClass = "";
$memberNation = "";
$memberRank = "";
$memberLevel = "";
$submit = "Add Member";
$hidden = "addmember";
}
else {
$member_id = $_GET['member'];
$query = db_query(
"SELECT *
FROM {$db_prefix}jpd_members
WHERE member_id LIKE $member_id", __FILE__, __LINE__);
$row = mysql_fetch_assoc($query);
$memberName = $row['memberName'];
$memberClass = $row['memberClass'];
$memberNation = $row['memberNation'];
$memberRank = $row['memberRank'];
$memberLevel = $row['memberLevel'];
$submit = "Edit Member";
$hidden = "editmember";
}
Next to change was;
echo '<form action="' . $scripturl . '?page=' . $page . '" method="POST">';
echo '<center><table>
<input type="hidden" name="' . $hidden . '" value="2">
<input type="hidden" name="player_id" value="' . $player_id . '">
<tr><td align="right">Player Name:</td>
<td align="left"><input type="text" name="playerFName" value="' . $playerFName . '"> <input type="text" name="playerLName" value="' . $playerLName . '"></td></tr>
<tr><td align="right">Team:</td>
<td align="left"><select name="team_id">
<option value=""> </option>';
foreach ($teams as $key => $team) {
echo '<option value="' . $key . '"';
if ($team_id == $key)
echo ' SELECTED ';
echo '>' . $team . '</option>';
}
echo '</select>';
echo '</td></tr>
<tr><td align="right">Position:</td>
<td align="left"><select name="playerPosition">';
foreach ($positions as $position) {
echo '<option';
if ($playerPosition == $position)
echo ' SELECTED ';
echo '>' . $position . '</option>';
}
echo '</select>';
echo '</td></tr>
<tr><td align="right">Nationality:</td>
<td align="left"><select name="playerNationality">';
asort($countries);
foreach ($countries as $key => $country) {
echo '<option value="' . $key . '"';
if ($playerNationality == $key)
echo ' SELECTED ';
echo '>' . $country . '</option>';
}
echo '</select>';
echo '</td></tr>
<tr><td align="right">Salary:</td>
<td align="left">$<input type="text" name="playerSalary" value="' . $playerSalary . '"></td></tr>
<tr><td align="right">Career Number of Goals:</td>
<td align="left"><input type="text" name="playerGoals" value="' . $playerGoals . '" size="3"></td></tr>
<tr><td align="right">Career Number of Assists:</td>
<td align="left"><input type="text" name="playerAssists" value="' . $playerAssists . '" size="3"></td></tr>
<tr><td align="right">Career Number of Clean Sheets:</td>
<td align="left"><input type="text" name="playerCleanSheets" value="' . $playerCleanSheets . '" size="3"></td></tr>
<tr><td colspan="2" align="center"><INPUT type="submit" name="team" value="' . $submit . '"></td></tr>';
echo '</table></center></form>';
$printed = 1;
}
I didn't change anything here since I couldn't understad much of it :laugh:
And to to the next part;
// Add player to database
elseif (isset($_POST['addplayer']) && $_POST['addplayer'] == 2 && $user_info['is_admin']) {
$team_id = $_POST['team_id'];
$playerName = $_POST['playerName'];
$playerPosition = $_POST['playerPosition'];
$playerNationality = $_POST['playerNationality'];
$playerSalary = $_POST['playerSalary'];
$playerGoals = $_POST['playerGoals'];
$playerAssists = $_POST['playerAssists'];
$playerCleanSheets = $_POST['playerCleanSheets'];
db_query("INSERT INTO `{$db_prefix}jpd_fanplayers`
(player_id,team_id,playerFName,playerLName,playerPosition,playerNationality,playerSalary,playerGoals,playerAssists,playerCleanSheets)
VALUES (NULL, '$team_id', '$playerFName', '$playerLName', '$playerPosition', '$playerNationality', '$playerSalary', '$playerGoals', '$playerAssists', '$playerCleanSheets')", __FILE__, __LINE__);
}
//**Update player in database
elseif (isset($_POST['editplayer']) && $_POST['editplayer'] == 2 && $user_info['is_admin']) {
$player_id = $_POST['player_id'];
$team_id = $_POST['team_id'];
$playerFName = $_POST['playerFName'];
$playerLName = $_POST['playerLName'];
$playerPosition = $_POST['playerPosition'];
$playerNationality = $_POST['playerNationality'];
$playerSalary = $_POST['playerSalary'];
$playerGoals = $_POST['playerGoals'];
$playerAssists = $_POST['playerAssists'];
$playerCleanSheets = $_POST['playerCleanSheets'];
db_query("UPDATE `{$db_prefix}jpd_fanplayers`
SET `player_id` = '$player_id', `team_id` = '$team_id', `playerFName` = '$playerFName', `playerLName` = '$playerLName',`playerPosition` = '$playerPosition',
`playerNationality` = '$playerNationality', `playerSalary` = '$playerSalary', `playerGoals` = '$playerGoals',
`playerAssists` = '$playerAssists', `playerCleanSheets` = '$playerCleanSheets'
WHERE `player_id` =$player_id", __FILE__, __LINE__);
}
I changed to;
// Add member to database
elseif (isset($_POST['addmember']) && $_POST['addmember'] == 2 && $user_info['is_admin']) {
$memberName = $_POST['memberName'];
$memberClass = $_POST['memberClass'];
$memberNation = $_POST['memberNation'];
$memberRank = $_POST['memberRank'];
$memberLevel = $_POST['memberLevel'];
db_query("INSERT INTO `{$db_prefix}jpd_members`
(member_id,memberName,memberClass,memberNation,memberRank,memberLevel)
VALUES (NULL, '$memberName', '$memberClass', '$memberNation', '$memberRank', '$memberLevel')", __FILE__, __LINE__);
}
//**Update player in database
elseif (isset($_POST['editmember']) && $_POST['editmember'] == 2 && $user_info['is_admin']) {
$member_id = $_POST['member_id'];
$memberName = $_POST['memberName'];
$memberClass = $_POST['memberClass'];
$memberNation = $_POST['memberNation'];
$memberRank = $_POST['memberRank'];
$memberLevel = $_POST['memberLevel'];
db_query("UPDATE `{$db_prefix}jpd_jpd_members`
SET `member_id` = '$member_id', `memberName` = '$memberName', `memberClass` = '$memberClass', `memberNation` = '$memberNation',`memberRank` = '$memberRank',
`memberLevel` = '$memberLevel'
WHERE `member_id` =$member_id", __FILE__, __LINE__);
}
And then this final part of the code;
//**Display a team's roster
elseif (isset($_GET['team']) && !isset($_GET['editteam'])) {
$team = $_GET['team'];
$awards = array();
$query = db_query(
"SELECT *
FROM {$db_prefix}jpd_fanteams
WHERE team_id LIKE '$team'", __FILE__, __LINE__);
$row = mysql_fetch_assoc($query);
$teamowner = '<a href="' . $scripturl . '?action=profile;u=' . $row['teamOwnerID'] . '">' . $row['teamOwner'] . '</a>';
$teamstadium = $row['teamStadium'];
$query = db_query(
"SELECT *
FROM {$db_prefix}jpd_fanplayers
WHERE team_id LIKE '$team'
ORDER BY playerLName", __FILE__, __LINE__);
while ($row = mysql_fetch_assoc($query)) {
$roster[$row['playerPosition']][$row['player_id']]['name'] = $row['playerFName'] . ' ' . $row['playerLName'];
$roster[$row['playerPosition']][$row['player_id']]['nationality'] = '<img src="' . $flag_dir . $row['playerNationality'] . '.png" alt="' . $countries[$row['playerNationality']] . '" />';
$roster[$row['playerPosition']][$row['player_id']]['salary'] = $row['playerSalary'];
$roster[$row['playerPosition']][$row['player_id']]['goals'] = $row['playerGoals'];
$roster[$row['playerPosition']][$row['player_id']]['assists'] = $row['playerAssists'];
$roster[$row['playerPosition']][$row['player_id']]['cleansheets'] = $row['playerCleanSheets'];
}
$query = db_query(
"SELECT *
FROM {$db_prefix}jpd_fanawards
WHERE team_id LIKE '$team'
ORDER BY awardYear,awardType", __FILE__, __LINE__);
while ($row = mysql_fetch_assoc($query))
$awards[] = '<tr><td>' . $row['awardYear'] . '</td><td align="left">' . $row['awardType'] . '</td></tr>';
echo '<table width="100%">
<tr><td colspan="6" align="center" class="catbg" style="font-size: 120%;">' . $teams[$team];
echo '<table><tr><td width="17%" align="right">Owner:</td><td width="16%" align="left">'. $teamowner . '</td><td width="34%">';
echo '<table>';
foreach ($awards as $award)
echo $award;
echo '</table>';
echo '</td><td width="17%" align="right">Stadium:</td><td width="16%" align="left">'. $teamstadium . '</td></tr></table>';
echo '</td></tr>';
foreach ($positions as $position) {
echo '<tr><td colspan="6" align="left" class="titlebg">' . $position . '</td></tr>';
echo '<tr class="windowbg"><td align="center">Name</td>
<td align="center">Nationality</td>
<td align="center">Salary</td>
<td align="center">Career Goals</td>
<td align="center">Career Assists</td>
<td align="center">Career Clean Sheets</td></tr>';
if (isset($roster[$position])) {
foreach ($roster[$position] as $player) {
echo '<tr class="windowbg2">';
echo '<td align="center">' . $player['name'] . '</td>';
echo '<td align="center">' . $player['nationality'] . '</td>';
echo '<td align="center">$' . $player['salary'] . '</td>';
echo '<td align="center">' . $player['goals'] . '</td>';
echo '<td align="center">' . $player['assists'] . '</td>';
echo '<td align="center">' . $player['cleansheets'] . '</td>';
echo '</tr>';
}
}
}
echo '<tr><td colspan="6" align="center" class="catbg">&nb' . 'sp;</td></tr>';
echo '</table>';
$printed = 1;
}
if ($printed == 1) { echo '<hr />'; }
echo '<form action="' . $scripturl . '" method="GET">';
echo '<center><table>
<input type="hidden" name="page" value="' . $page . '">
<tr><td align="right">Which team' . "'" . 's roster<br />do you want to see?</td>
<td align="left"><select name="team">
<option value=""> </option>';
foreach ($teams as $key => $team)
echo '<option value="' . $key . '">' . $team . '</option>';
echo '</select>';
echo '</td></tr>
<tr><td colspan="2" align="center"><INPUT type="submit" name="go" value="Show Me"></td></tr>';
echo '</table></center></form>';
if ($user_info['is_admin']) {
echo '<table>';
// Add or edit team
echo '<form action="' . $scripturl . '" method="GET">
<input type="hidden" name="page" value="' . $page . '">
<tr><td align="right">Choose team to edit</td>
<td align="left"><select name="team">
<option value=""> </option>';
foreach ($teams as $key => $team)
echo '<option value="' . $key . '">' . $team . '</option>';
echo '</select>';
echo ' <INPUT type="submit" name="editteam" value="Edit"></td>
<td><INPUT type="submit" name="addteam" value="Add new team"></td></tr>';
echo '</form>';
//Add or edit player
echo '<form action="' . $scripturl . '" method="GET">';
echo '<input type="hidden" name="page" value="' . $page . '">
<tr><td align="right">Choose player to edit</td>
<td align="left"><select name="player">
<option value=""> </option>';
$query = db_query(
"SELECT *
FROM {$db_prefix}jpd_fanplayers
ORDER BY playerLName", __FILE__, __LINE__);
while ($row = mysql_fetch_assoc($query))
echo '<option value="' . $row['player_id'] . '">' . $row['playerFName'] . ' ' . $row['playerLName'] . '</option>';
echo '</select>';
echo ' <INPUT type="submit" name="editplayer" value="Edit"></td>
<td><INPUT type="submit" name="addplayer" value="Add new player"></td></tr>';
echo '</form>';
//Add or edit award
echo '<form action="' . $scripturl . '" method="GET">';
echo '<input type="hidden" name="page" value="' . $page . '">
<tr><td align="right">Choose award to edit</td>
<td align="left"><select name="award">
<option value=""> </option>';
$query = db_query(
"SELECT *
FROM {$db_prefix}jpd_fanawards
ORDER BY awardYear,awardType", __FILE__, __LINE__);
while ($row = mysql_fetch_assoc($query))
echo '<option value="' . $row['award_id'] . '">' . $row['awardYear'] . ' ' . $row['awardType'] . '</option>';
echo '</select>';
echo ' <INPUT type="submit" name="editaward" value="Edit"></td>
<td><INPUT type="submit" name="addaward" value="Add new award"></td></tr>';
echo '</form>';
echo '</table>';
}
I didn't touch this code at all ^^. So, at this point I'm wondering if I have done anything right yet or the parts that I changed have been to no vain ? This is way over my head :uglystupid2: but I still wanted to try ;D
Did it work? That's how I test things. I plug them into a php article and start tracking down the bugs. You'll need a text editor that tells you what the line numbers are so you can find things more easily.
Quote from: JPDeni on July 07, 2009, 05:14:49 AM
Did it work? That's how I test things. I plug them into a php article and start tracking down the bugs. You'll need a text editor that tells you what the line numbers are so you can find things more easily.
No, I doesn't work, only getting a blank screen ^^. I have not change a lot of the code since I didn't really know what to change.
It will take several days for me to get to this and give it a really good look.
Quote from: JPDeni on July 07, 2009, 12:53:44 PM
It will take several days for me to get to this and give it a really good look.
Thank you JPDeni :D
You know, rather than try to mangle my previous code to fit your needs, it would probably be better to start from scratch. Start a new topic in the Requests board, describing what you need. Don't refer to this code at all. Pretend that nothing has ever been written that is even close to what you want. Once you get that done, I'll put you in the queue of custom code that has been requested.
Quote from: JPDeni on July 07, 2009, 10:53:43 PM
You know, rather than try to mangle my previous code to fit your needs, it would probably be better to start from scratch. Start a new topic in the Requests board, describing what you need. Don't refer to this code at all. Pretend that nothing has ever been written that is even close to what you want. Once you get that done, I'll put you in the queue of custom code that has been requested.
Ok ^^