PHP Roster!

Post Reply
PatrickLA_CA
Posts: 2243
Joined: 2009-07-14 09:31

PHP Roster!

Post 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?
In-game: Cobra-PR
AfterDune
Retired PR Developer
Posts: 17094
Joined: 2007-02-08 07:19

Re: PHP Roster!

Post 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 :) .
Image
Psyrus
Retired PR Developer
Posts: 3841
Joined: 2006-06-19 17:10

Re: PHP Roster!

Post 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.

:)
PatrickLA_CA
Posts: 2243
Joined: 2009-07-14 09:31

Re: PHP Roster!

Post 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.
In-game: Cobra-PR
Psyrus
Retired PR Developer
Posts: 3841
Joined: 2006-06-19 17:10

Re: PHP Roster!

Post 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.
PatrickLA_CA
Posts: 2243
Joined: 2009-07-14 09:31

Re: PHP Roster!

Post by PatrickLA_CA »

Ok, thanks, I'll look around w3, the place I learned HTML from.
In-game: Cobra-PR
PatrickLA_CA
Posts: 2243
Joined: 2009-07-14 09:31

Re: PHP Roster!

Post 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 :D
In-game: Cobra-PR
Deadfast
Retired PR Developer
Posts: 4611
Joined: 2007-07-16 16:25

Re: PHP Roster!

Post by Deadfast »

Ideas for what exactly? How the SQL tables should look?
PatrickLA_CA
Posts: 2243
Joined: 2009-07-14 09:31

Re: PHP Roster!

Post 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.
In-game: Cobra-PR
Psyrus
Retired PR Developer
Posts: 3841
Joined: 2006-06-19 17:10

Re: PHP Roster!

Post 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.
Post Reply

Return to “General Technical Support”