You said:
Hi,
That PHP scripted worked 100%,
How i do go about the other way of writeing infomation to the file ?
Thx dan
I assume you mean you want to amend the selected record, and then write it back to the text file, in the same place. Trouble is, this sort of thing is much easier with a database than with a text file.
The simple way is to read the whole file into an array to start (use 'file'). Then replace just the element of the array you've changed, and write the whole array back to the file.
So - assuming you've got your fields to replace all ready:
$newrec = "$f1|$f2|$f3|$f4\r\n";
$fcontents = file ("file.txt");
$fp = fopen ("file.txt","w");
flock ($fp,LOCK_EX);
while (list ($line_num, $rec) = each ($fcontents)) {
if ($line_num == $number) $rec = $newrec;
fputs ($fp,$rec);
}
fclose ($fp);
echo "Line $number updated OK<br>";
Not very pretty, really!