Derleek Posted May 28, 2008 Share Posted May 28, 2008 ok, so i have generated this script to store each line from a file into an array: //retrieves file name and size form the form $fileName = $_FILES['userfile']['name']; $fileSize = $_FILES['userfile']['size']; // open the file and save each line as an array entry in $content $content = file($fileName); // count how many lines in the file $numLines = count($content); //counts how many riders are in the file $numRider = $numLines/4; // loop through all the lines $rstore = array();//array to store the $line variable for ($i = 0; $i < $numLines; $i++) { $line = trim($content[$i])."<br>"; $rstore[$i] = $line; } //declaration of arrays for storage into MySQL $Rname = array(); $Rnum = array(); $Rqual = array(); $Rplace= array(); //loops through and stores rider name, number, qualified, placed into each of the respective arrays with identical key's $slot = 0; for ($i = 0; $i<$numRider; $i++) { $Rname[$i] = $rstore[$slot]; $slot++; $Rnum[$i] = $rstore[$slot]; $slot++; $Rqual[$i] = $rstore[$slot]; $slot++; $Rplace[$i]= $rstore[$slot]; $slot++; } but for some reason it is storing return... so when i output it i get line1 line2 line3 line4 with out entering a carriage return... i thought trim() was used to strip down returns? Quote Link to comment Share on other sites More sharing options...
Derleek Posted May 28, 2008 Author Share Posted May 28, 2008 silly mistake... **note the "<br>" when i set the value of $line... silly me Quote Link to comment 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.