"Soccer" Database

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
malcolmboston
DevNet Resident
Posts: 1826
Joined: Tue Nov 18, 2003 1:09 pm
Location: Middlesbrough, UK

"Soccer" Database

Post by malcolmboston »

Hello guys

well you americans probably dont have a clue what i mean, anyway:

Ive been developing over the last few months a PHP 'Championhip Manager' Clone and ive done some substantial work on it, i have been looking on the net and cannot find a MySQL database containing players, playing for what club, stats, history etc, ive currently been developing it with fake playres but now i think its time to go to real players.

It 'must' have the English premiership, Div's 1,2 + 3 lists, and possibly other nations would be a major bonus.

I would print the text files from my champ manager 03/04 but have no idea how to automatically insert the different data into MySQL

any help would be fantastic
User avatar
JayBird
Admin
Posts: 4524
Joined: Wed Aug 13, 2003 7:02 am
Location: York, UK
Contact:

Post by JayBird »

What do the text files look like from CM?

Mark
malcolmboston
DevNet Resident
Posts: 1826
Joined: Tue Nov 18, 2003 1:09 pm
Location: Middlesbrough, UK

Post by malcolmboston »

just showing simple stats

Code: Select all

================================================================================================
 Squad
================================================================================================

No  Name                       Position(s)  Nat  Born      Age  Caps Gls  Wages     Expires   Value
-----------------------------------------------------------------------------------------------------
-   Aliaj, Adrian              D/DM LC      ALB  24.9.73   27   3    -    £625      30.6.03   £425K     
-   Belai, Arian               DM C         ALB  1.2.71    30   15   2    £800      30.12.03  £650K     
-   Beqaj, Arjan               GK           ALB  25.8.75   25   10   -    £825      30.6.04   £650K     
-   Bogdani, Erjon             S C          ALB  14.4.77   24   -    -    £9.75K    30.6.04   £2.9M     
-   Bushaj, Alban              S C          ALB  20.8.73   27   34   8    £4.3K     31.5.06   £2M       
-   Chatzi, Altin              AM R         ALB  17.1.75   26   29   -    £1.1K     30.6.04   £1.3M     
-   Cipi, Geri                 SW/D C       ALB  28.2.74   27   17   -    £1.6K     30.6.04   £2.8M     
-   Dede, Nevil                D/DM C       ALB  10.1.75   26   6    -    £2K       5.2.05    £300K     
-   Driza, Johan               D/DM RC      ALB  20.9.76   24   4    -    £1.9K     7.2.02    £275K     
-   Duro, Klodian              AM R         ALB  21.12.77  23   -    -    £1.4K     29.8.03   £2M       
-   Fakaj, Ervin               D C          ALB  15.6.76   25   25   -    £1.5K     27.5.02   £650K     
-   Fortuzi, Indrit            AM/F L       ALB  23.11.73  27   19   -    £2.5K     2.2.04    £350K     
-   Grima, Armir               GK           ALB  16.6.74   27   4    -    £800      11.2.06   £70K      
-   Hasi, Besnik               SW/DM C      ALB  29.12.69  31   13   -    £3K       30.6.05   £1.4M     
-   Jupi, Redi                 DM C         ALB  31.5.75   26   5    -    £2K       3.2.07    £325K     
-   Kola, Blendar              AM L         ALB  1.8.72    28   11   3    £600      30.6.03   £325K     
-   Kotsa, Elton               F C          ALB  8.8.71    29   -    -    £1K       30.6.04   £450K     
-   Lala, Altin                DM RC        ALB  18.11.74  26   24   -    £10K      30.6.03   £2.7M     
-   Murati, Edwin              AM L         ALB  12.11.73  27   13   2    £4K       30.6.03   £800K     
-   Pinari, Luan               SW/D C       ALB  27.10.77  23   4    -    £1.4K     2.2.06    £325K     
-   Rraklli, Altin             S C          ALB  17.7.70   30   45   9    £4.4K     22.7.03   £800K     
-   Skela, Ervin               AM LC        ALB  17.11.76  24   9    1    £8.75K    30.6.03   £3.8M     
-   Strakosia, Fotis           GK           ALB  23.3.65   36   52   -    £600      30.6.03   £150K     
-   Tare, Igli                 S C          ALB  25.8.71   29   35   13   £24.5K    30.6.04   £4.3M     
-   Vata, Fatmir               F C          ALB  20.9.71   29   14   -    £10.75K   30.6.03   £2M       
-   Zoumba, Arian              SW/D C       ALB  6.7.66    35   11   2    £1K       30.6.03
User avatar
JayBird
Admin
Posts: 4524
Joined: Wed Aug 13, 2003 7:02 am
Location: York, UK
Contact:

Post by JayBird »

hmmmm, the info isn't really delimited very well.

You could try exploding each line on the spaces, but not sure if there will be a problem doing that (i.e. names with spaces is!?)

Mark
User avatar
JayBird
Admin
Posts: 4524
Joined: Wed Aug 13, 2003 7:02 am
Location: York, UK
Contact:

Post by JayBird »

...oooh, is it tab delimited?

Mark
malcolmboston
DevNet Resident
Posts: 1826
Joined: Tue Nov 18, 2003 1:09 pm
Location: Middlesbrough, UK

Post by malcolmboston »

yep :cry:
User avatar
JayBird
Admin
Posts: 4524
Joined: Wed Aug 13, 2003 7:02 am
Location: York, UK
Contact:

Post by JayBird »

easy peasy :)

hold on.....
User avatar
JayBird
Admin
Posts: 4524
Joined: Wed Aug 13, 2003 7:02 am
Location: York, UK
Contact:

Post by JayBird »

something like this. I have actually written the full code before on this forum somewhere, cant find it at the moment though

Code: Select all

// open the data file
($fp = fopen("../data/player_data.txt", 'r')) or die ("Couldn't open the data file");
	
// Iterate through each line of the file
while ( ! feof($fp) ) {
	$line = fgets($fp, 1024);
		
	// remove any extra white space or carriage returns
	$line = chop($line);
	
	// spilt each line into individual fields
	$data = explode("\t", $line);
		
	// Do your INSERT QUERY HERE
}
	
fclose($fp);
Mark
timvw
DevNet Master
Posts: 4897
Joined: Mon Jan 19, 2004 11:11 pm
Location: Leuven, Belgium

Post by timvw »

malcolmboston
DevNet Resident
Posts: 1826
Joined: Tue Nov 18, 2003 1:09 pm
Location: Middlesbrough, UK

Post by malcolmboston »

Bech100 wrote:something like this. I have actually written the full code before on this forum somewhere, cant find it at the moment though

Code: Select all

// open the data file
($fp = fopen("../data/player_data.txt", 'r')) or die ("Couldn't open the data file");
	
// Iterate through each line of the file
while ( ! feof($fp) ) {
	$line = fgets($fp, 1024);
		
	// remove any extra white space or carriage returns
	$line = chop($line);
	
	// spilt each line into individual fields
	$data = explode("\t", $line);
		
	// Do your INSERT QUERY HERE
}
	
fclose($fp);
Mark
Thanks Mark, my net connection died yesterday so didnt get time to say thanks

and it works btw peeps.....
User avatar
JayBird
Admin
Posts: 4524
Joined: Wed Aug 13, 2003 7:02 am
Location: York, UK
Contact:

Post by JayBird »

malcolmboston wrote:and it works btw peeps.....
you didn't ever doubt it did ya :lol:

Mark
malcolmboston
DevNet Resident
Posts: 1826
Joined: Tue Nov 18, 2003 1:09 pm
Location: Middlesbrough, UK

Post by malcolmboston »

lol, well it works in all intent and purposes, im gonna try and edit it and add some *reg replaces in it because at the moment it keeps stuff in the files that i dont want to store so it means me editing every file (120 * 5 Minimium)

But it does what i asked it to do
Mark wrote: you didn't ever doubt it did ya
:roll:
jason
Site Admin
Posts: 1767
Joined: Thu Apr 18, 2002 3:14 pm
Location: Montreal, CA
Contact:

Post by jason »

=p

c'mon guys...put it in the right forum :)
Post Reply