reading a .txt file w/PHP and storing the data in mySQL

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi, new to the list and new period =) I found this great little gem
while RTFM and I modified it slightly for my use.

//<?php
// Get a file into an array.  In this example we'll go through HTTP to get
// the values from the file that is being read
//$lines = file('http://www.w-ifc.com/test/SCORE.TXT');

// Loop through our array, show source; and line numbers too.
//foreach ($lines as $line_num => $line) {
//   echo "Line #<b>{$line_num}</b> : " . htmlspecialchars($line) . "<br />\n";
//}

//?>

and .. it works nicely as you can see here ...

http://w-ifc.com/test/get_score.php

Now, it's seems fortunate that each Line#'s  (or now each "array"??) 
data is specific unto itself and there are no dependencies from other
lines in terms of managing the data.

So, now I wan't to store my array's in a nice orderly fashion in mySQL
DB. Which, I understand the basic stuff for getting into the DB. I
just don't quite understand my next step with the array itself... 
should explode() each line now to index each array or...  preset the
variables and then ...

Here is the breakdown of the DB I invision using

THINGS LIST
============
id                      <-key
game_id                 <-maybe secondary key? (designated by upload interface)
game_date               (timezone specific on interface upload)
game_type               (heads up, 2 -vs- 2, tournement, stroke,
match, etc, etc)
game_format             (style of play, scotch doubles, rotations, etc, ect)
game_version            (version of game used)
course_name             (self)
course_rating           (build or use existing formulae)

hole_played             (self)
hole_handicap           (self)
hole_yardage            (self)
hole_par                (self)

player_name             ...
player_handicap         ...
player_score            ...
player_tee_box          ...

game_conditions         ...
pin_positions           ...
gimmes                  ...
mulligans               ...

front_9                ...
back_9               ...
total                   ...
============

Your input is very appreciated and thanks ahead =)

Wik

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux