I have a code that works in taking the format of:
01-Sep-07, Northern Colorado 3, Hawaii 63
01-Sep-07, Marshall 3, Miami 31
And inserts it into my current database, how can I modify it do take the same info and insert it into the database, with a table structure that Piranna posted above?
Here's the code I'm using now:
<?php
require ( "dbconnex.php" );
$lines = file('wv_scores.txt');
foreach ($lines as $line)
{
$team = $score = array();
$teamscore = explode(',', $line);
foreach ($teamscore as $k=>$ts)
{
$x = strrpos($ts, ' ');
$team[$k] = trim(substr($ts,0,$x));
$score[$k] = trim(substr($ts,$x));
}
$games_rs = $conn->Execute ( "INSERT INTO wvhs_gm (team1_name, team1_score, team2_name, team2_score, ) VALUES ('$team[0]', '$score[0]', '$team[1]', '$score[1]')" ) or die ( $conn->ErrorMsg() );
}
?>
My structure would be:
TABLE wvhs_gm
gameID
game_date
game_year
TABLE wvhs_gm_info
gameID
teamID
team_name
team_score