Jump to content

[SOLVED] add data to database


tyra

Recommended Posts

$file = file('datafile.txt');

$fh = fopen('datafile.txt', "w+"); // truncate file and open for writing
foreach ($file as $line) {
    $inputs = explode($line); 
    $inputs[0]++; // add1 to the first number
    $inputs[3]++; // add 1 to the last number

    fwrite($fh, implode(";", $inputs) . "\n"); // write back to file on a new line
}
fclose($fh);

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.