Ok, i have a small issue. Im trying to upload a .txt file. It has 5 columns and up to 60 rows. What i wanna do is simple really. I wanna delete everything from the .txt but the 2nd column. Then I wanna add 2 columns after it one which will be date.
Ive tried getting queys down to even show the .txt before uploading but cant get that right. Heres what i tried.
$content=file("$form_data1");
// I had to play around with this in order to include the last 2 columns,
//previously it was truncating the column list
$tabbed=implode("",preg_replace('%[ ]{2,}%s', "\t", $content));
preg_match_all("%(.*)\t(.*)\t(.*)\t(.*)\t(.*)\t(.*)\t(.*)\t(.*)\t(.*)\t(.*)\t(.*)\t(.*)\t(.*)\t(.*)\t(.*)\t(.*)\t(.*)\t(.*)\t(.*)\t(.*)\t(.*)\t(.*)%miU", $tabbed, $matches);
// print out table
echo '<table border="1">
<tr>
<th>'.$matches[1][0].'</th>
<th>'.$matches[2][0].'</th>
<th>'.$matches[3][0].'</th>
<th>'.$matches[4][0].'</th>
<th>'.$matches[5][0].'</th>
</tr>';
for ($i=1; $i<count($matches[1]);$i++)
echo '<tr>
<td>'.$matches[1][$i].'</td>
<td>'.$matches[2][$i].'</td>
<td>'.$matches[3][$i].'</td>
<td>'.$matches[4][$i].'</td>
<td>'.$matches[5][$i].'</td>
</tr>';
echo '</table>';