Page 1 of 1
PHP Roster!
Posted: 2011-01-29 19:59
by PatrickLA_CA
I'm making a website for my clan and they said the roster needs to be clickable (.php) so details for each member will pop up, you know, but the problem is that I'm not good at .php, so I was hoping for some help if anyone can offer?
Re: PHP Roster!
Posted: 2011-01-29 20:05
by AfterDune
Depending on what you want, I'm sure there are free php-apps out there that fit your needs. Like, a forum with a frontpage, team roster, etc, etc. Or go for a wiki-setup, easy as well

.
Re: PHP Roster!
Posted: 2011-01-29 20:54
by Psyrus
You have a database with all the players in it... or is it currently just in HTML?
Basically you can just throw together a really rudimentary MYSQL database with a table called 'players';
Table fields would be as such:
playerID [key]
playerName
playerAlias (if applicable)
- other information goes here
Then for your roster page you just use php to grab the player IDs & playerNames/Aliases, use a loop to display each name with a link to a popup like [html]<a href='playerinfo.php?id=$playerID' target='_blank'>$playerName</a>[/html] and from there on playerinfo.php you grab the player's info from the database based upon which $_GET['id'] is present and display it however you want.

Re: PHP Roster!
Posted: 2011-01-29 23:02
by PatrickLA_CA
The problem is that I don't know PHP, I have a HTML website done, but the roster part is empty and I want to have a table with all the units and members in it, and when you click on a member, something pops up (not an HTML file tho, so I don't have to make a new page for every member) and shows some pictures and info about the member.
Re: PHP Roster!
Posted: 2011-01-29 23:08
by Psyrus
PatrickLA_CA wrote:The problem is that I don't know PHP, I have a HTML website done, but the roster part is empty and I want to have a table with all the units and members in it, and when you click on a member, something pops up (not an HTML file tho, so I don't have to make a new page for every member) and shows some pictures and info about the member.
So take 2-3 days to learn the fundamentals of the php-mysql pairing. It's not difficult...
You've clearly taken the time to understand HTML and the jump from HTML+CSS -> PHP would probably be just under the jump from no-scripting -> HTML, so it's doable.
Google php tutorials, learn how to interact with a MYSQL database (particularly through PHPMYADMIN) and away you go. Pretty much everyone I know who does php is self-taught by e-tutorials, myself included.
Re: PHP Roster!
Posted: 2011-01-30 10:52
by PatrickLA_CA
Ok, thanks, I'll look around w3, the place I learned HTML from.
Re: PHP Roster!
Posted: 2011-02-11 18:41
by PatrickLA_CA
I Googled mysql and php tutorials but I didn't understand any of it, tried some stuff, but never came out what I want, I have all the website done, the roster table with names and stuff done, only thing left is to put links on the player names to the database or whatever it is, here is a link to a roster like I want:
3rd Infantry Division - 8 years strong - ArmaII Unit
If anyone's got any ideas, please share them with me

Re: PHP Roster!
Posted: 2011-02-11 18:44
by Deadfast
Ideas for what exactly? How the SQL tables should look?
Re: PHP Roster!
Posted: 2011-02-11 19:17
by PatrickLA_CA
Sorry I didn't mean ideas exactly , I meant help on how to do it or a link to a script or something if anyone could help?
I want it to look like that one in the link provided.
Re: PHP Roster!
Posted: 2011-02-11 22:07
by Psyrus
Making it 'look' like that is just accomplished through CSS/HTML
Basically to get something like that page, the guy would've simply run the following loop:
CPT Captain Gavin Townsend Commanding Officer M16A4 Active
[PHP]
$players = mysql_query(select * from players);
echo("<table class='something'>");
echo("<tr class='headerRow'>
<td>Rank </td>
<td>Name </td>
<td>Role </td>
<td>Weapon </td>
<td>Status</td>
</tr>");
while ($row = mysql_fetch_assoc($players))
{
echo("<tr class='clrSwitch_".$bit."'>
<td>".getRankIcon($row['rank'])."</td>
<td>".$row['name']."</td>
<td>".$row['role']."</td>
<td>".$row['weapon']."</td>
<td>".$row['status']."</td>
</tr>");
}
echo("</table>");
[/PHP]
I couldn't be bothered subcategorizing them by their squad, but that would just involve group by statements and a special <tr> when the $row['squad'] changed. Hopefully this helps you understand what you need to do.