jwer78 Posted August 20, 2007 Share Posted August 20, 2007 Hi all I need a little help with modifying this script. It reads from a txt file and dumbs the data into the database. Well the txt file has some new data displayed for the defense, in particular CTH Allow and Big Hit. I added these to the line but it still isnt reading them and dumping the data. Im sure I am missing something so any help would be appreciated. Thanks in advance. elseif( $line=="PASSING CMP ATT YDS PCT YPA SACK TD INT LONG RATING\n" || $line=="RUSHING ATT YDS AVG LONG TD FUM\n" || $line=="RECEIVING REC YDS AVG LONG TD DROP YAC\n" || $line=="KICKING FGM FGA PCT FGSBLOCKED XPA XPM PCT XPSBLOCKED KICKOFFS TOUCHBACKS\n" || $line=="PUNTING ATT YDS AVG LONG BLOCKS IN20 TOUCHBACKS\n" || $line=="DEFENSE TOT LOSS SACK FF FREC YDS TD INT RET AVG DEFLECTIONS SAFETIES CTH ALLOW BIG HITS\n" || $line=="BLOCKING PANCAKES SACKS ALLOWED\n" ){ $category = preg_split ("/[\s,]+/", strtolower($line)); $num_categories = count($category); $num_categories--; $table="game_" . $category[0]; $variable_array[0]=$category[0] . "_player"; for($count=1; $count<$num_categories; $count++) $variable_array[$count]= $category[0] . "_" .$category[$count]; $line = @fgets ($fp, 1024); while (substr($line,0,1)!="\n"){ $line = ereg_replace ("\'","",$line); $data = preg_split ("/[\s,]+/", trim(substr($line, 30, 1000))); $$variable_array[0] = trim(substr($line, 0, 29)); for($count=1; $count<$num_categories; $count++) $$variable_array[$count] = $data[$count-1]; $query_name = "game_" . $category[0]; $$query_name = "INSERT into $table values('','$game_id','$active_team'"; for($count=0; $count<$num_categories; $count++) $$query_name = $$query_name . ",'" . trim($$variable_array[$count]) . "'"; $$query_name = $$query_name . ")"; echo $$query_name . "<BR>"; $res=mysql_query($$query_name,$db); $line = @fgets ($fp, 1024); } } Quote Link to comment https://forums.phpfreaks.com/topic/65770-solved-need-a-little-help-with-modifying-this-script/ Share on other sites More sharing options...
jwer78 Posted August 20, 2007 Author Share Posted August 20, 2007 NM guys I got it. Thanks Quote Link to comment https://forums.phpfreaks.com/topic/65770-solved-need-a-little-help-with-modifying-this-script/#findComment-328593 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.