User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the PHP section within the Web Development category of DaniWeb, a massive community of 391,940 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,865 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our PHP advertiser: Lunarpages PHP Web Hosting
Views: 4453 | Replies: 11
Reply
Join Date: Sep 2004
Location: Cheltenham, UK
Posts: 20
Reputation: TimmyRaa is an unknown quantity at this point 
Rep Power: 4
Solved Threads: 0
TimmyRaa's Avatar
TimmyRaa TimmyRaa is offline Offline
Newbie Poster

PHP newbie, project feasibility

  #1  
Sep 6th, 2004
I've at least *seen* PHP code before, and have modified my own phpBB forum moderately.

However, I've been set a project to build a web interface for recording skittles scores (like 10-pin bowling, but with 9 pins!!), and producing a nice ordered table with player names, number of games played, their aggregate scores, highest/lowest score, and average score (like here). I've got the table at least designed to fit with our phpBB board here!

I've done some MSSQL DB work before, so I'm not too fazed with getting a reasonable DB structure designed - theory must be the same on MySQL? But when it comes to building an interface in PHP that will perform checks on the DB to make sure you're entering valid data (no more than 12 players/scores per match, one score per match per person, etc), and then retrieving that data, processing it, performing maths on it, sorting it, and displaying it, I have no idea where to start!!

Someone suggested Fireserv elsewhere to develop on, which I'm going to do, but I was really looking for an indication of how complex a project this sounds. Would an experienced PHP developer look at it and think it's "a bit hard"? If so, I think I'll give up now! :o

If I go ahead with it, I'll need some hand holding verging on complete coding help no doubt!

Hi BTW!

EDIT: If anyone has a recent up-to-date copy of Fireserv available, could you let me know please. Their site seems to be down, and the only copies available are over 2 years old.
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Jul 2004
Posts: 191
Reputation: PoA is an unknown quantity at this point 
Rep Power: 5
Solved Threads: 2
PoA PoA is offline Offline
Junior Poster

Re: PHP newbie, project feasibility

  #2  
Sep 8th, 2004
Try apache2triad. Google it for more info.
Reply With Quote  
Join Date: Sep 2004
Location: Cheltenham, UK
Posts: 20
Reputation: TimmyRaa is an unknown quantity at this point 
Rep Power: 4
Solved Threads: 0
TimmyRaa's Avatar
TimmyRaa TimmyRaa is offline Offline
Newbie Poster

Re: PHP newbie, project feasibility

  #3  
Sep 8th, 2004
Thanks, downloaded and installed, and it does indeed look very good.

Anyone able to comment on how tricky the project I described would be for a newbie, or indeed an expert?

I was considering breaking it down slightly, and initially just building a page that takes a comma-delimited text file as an input with the basic data for the table, and PHP takes that, sorts the rows, and displays it. Would that be particularly tricky, or perhaps more suitable for a newbie?
Reply With Quote  
Join Date: Sep 2004
Location: Cheltenham, UK
Posts: 20
Reputation: TimmyRaa is an unknown quantity at this point 
Rep Power: 4
Solved Threads: 0
TimmyRaa's Avatar
TimmyRaa TimmyRaa is offline Offline
Newbie Poster

Re: PHP newbie, project feasibility

  #4  
Sep 10th, 2004
Anyone able to give me, or knock up, a sample bit of PHP code that would take the following text file (called statistics.txt)...

Player 1, 4, 140, 38, 35, 35.0
Player 2, 5, 200, 46, 36, 40.0
Player 3, 4, 150, 40, 35, 37.5

...sort it based on the last column, and display it in a table?

Once I've got that, I can then expand it and develop it to pull the data from a database, and then onto the actual inputting of data into the DB.
Reply With Quote  
Join Date: Sep 2004
Posts: 4
Reputation: vscapes is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
vscapes vscapes is offline Offline
Newbie Poster

Re: PHP newbie, project feasibility

  #5  
Sep 12th, 2004
The project seems like a good place to get your feet wet with php / mysql. Initially it looks pretty simple. I would recommend using a db rather than text file so that mysql can do the math and sorting rather than relying on php for sorting.
Reply With Quote  
Join Date: Sep 2004
Location: Cheltenham, UK
Posts: 20
Reputation: TimmyRaa is an unknown quantity at this point 
Rep Power: 4
Solved Threads: 0
TimmyRaa's Avatar
TimmyRaa TimmyRaa is offline Offline
Newbie Poster

Re: PHP newbie, project feasibility

  #6  
Sep 12th, 2004
Thanks for the reply. I've actually had a look around this site and discovered some code snippets here, which shows how to build a page that simply stores and retrieves data from a DB.

I'm going to have a play with that, and see if I can make any sense of it.
Reply With Quote  
Join Date: Sep 2004
Location: Cheltenham, UK
Posts: 20
Reputation: TimmyRaa is an unknown quantity at this point 
Rep Power: 4
Solved Threads: 0
TimmyRaa's Avatar
TimmyRaa TimmyRaa is offline Offline
Newbie Poster

Re: PHP newbie, project feasibility

  #7  
Sep 12th, 2004
Right, I can see how to interact with a DB now. The next step, for my submit page I want to pull all the player names from a table in the database, and have those names available under a drop-down list (via the form OPTION VALUE="name" method).

The only way I can think of doing this would be to pull the values from the DB, get the number of hits and form a WHILE loop, to repeat the OPTION VALUE="" for as many times as there are names.

Is this the way to do it? If so, how do I construct it? If not, what is the best way?
Reply With Quote  
Join Date: Sep 2004
Posts: 4
Reputation: vscapes is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
vscapes vscapes is offline Offline
Newbie Poster

Re: PHP newbie, project feasibility

  #8  
Sep 12th, 2004
It would look something like this:

$sql = mysql_query("select name from table_name");

while ( $row = mysql_fetch_array($sql)) {

echo ("OPTION VALUE='$row[name]' ");

}

Hope this helps
Reply With Quote  
Join Date: Sep 2004
Location: Cheltenham, UK
Posts: 20
Reputation: TimmyRaa is an unknown quantity at this point 
Rep Power: 4
Solved Threads: 0
TimmyRaa's Avatar
TimmyRaa TimmyRaa is offline Offline
Newbie Poster

Re: PHP newbie, project feasibility

  #9  
Sep 12th, 2004
Woo hoo! PHP is starting to make sense to me! Thanks - I've got it updating the database now.

Now I know there is a DB section on this site, but I figured most of the background is in here, so I'll pose my next query here too...

I've now hit upon my next weakness; joining tables in SQL. I'm *okay* with nesting SQL queries, but I've just discovered that pre-MySQL 4.1 doesn't support nested queries, only joins. :cry:

I've got 3 tables:

matches - matchid, date, homeaway, season
players - playerid, fullname, nickname
scoreslist - scoreid, playerid, matchid, score

And as mentioned previously, I need to retrieve the appropriate scores (for the current season - 2004), and produce an ordered table of statistics (ordered on average column) as shown below - I've added notes on what each column relates to in the DB:

Player Name (players.fullname)
Games Played (just a count of the number of scores relating to a player this season)
Aggregate (the sum of all those scores relating to a player)
Highest (highest value from that list of scores)
Lowest (lowest value from that list of scores)
Average (games played / aggregate)

I'm having real problems knowing where to begin, and looking for guidance really. If only it supported nested queries! :-|
Reply With Quote  
Join Date: Sep 2004
Location: Cheltenham, UK
Posts: 20
Reputation: TimmyRaa is an unknown quantity at this point 
Rep Power: 4
Solved Threads: 0
TimmyRaa's Avatar
TimmyRaa TimmyRaa is offline Offline
Newbie Poster

Re: PHP newbie, project feasibility

  #10  
Sep 12th, 2004
Actually, even my nested skills obviously aren't up to scratch - all I've got so far is...

SELECT playerid, score
FROM scoreslist
WHERE IN (
SELECT matchid
FROM matches
WHERE season =2004
)

I've got the added problem of MySQL not having linked tables enabled, although from what I've read this can be worked around? I'm thinking for linking the scores (through playerid) to the fullnames column.
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

DaniWeb PHP Marketplace
Thread Tools Display Modes

Other Threads in the PHP Forum

All times are GMT -4. The time now is 8:41 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC