but the text file isn't in any special format. It has several different areas, that I want to parse seperately for different databases....
Below is a little clip of the text file showing the different spacings.
PASSING CMP ATT YDS PCT YPA SACK TD INT LONG RATING
Wally Davis 22 43 254 51 5.9 9 2 2 25 65.4
RUSHING ATT YDS AVG LONG TD FUM
Darnell Cobb 25 68 2.7 12 0 1
Tyrone Banks 1 8 8.0 8 0 0
Below is the current code I've started with, but have run into a wall.
<?php
$host = "localhost";
$username = "******";
$password = "******";
$database = "******";
$server = mysql_connect($host, $username, $password) or die(mysql_error());
$connection = mysql_select_db($database, $server);
$open = fopen("gamelog.txt","r");
$x=0;
$contents = fgets($open);
while($contents = fgets($open))
{
$x++;
$line_array[$x] = $contents;
$stats = explode(" ",$line_array[$x]);
// print $stats[0] . " " . $stats[1] . "<br>";
if ($stats[0] == "PASSING")
{
print $x . "<br>";
$x++;
print $x . "<br>";
print "Here is the Array for Passing<br>" . $line_array[$x] . "<br>";
$stats = explode(" ",$line_array[$x]);
print "Name?<br>" . $stats[0] . "<br>";
}
}
?>
I've spent over 12 hours with different things, and am completely lost now on what to do..... Obviously there isn't code for inputting into the database, because I can't even get it to ECHO the lines I want..... suggestions would be great, thanks!