Jump to content

Edit History

knacky

knacky

$in = fopen('original.csv', 'r');
$out = fopen('new.csv', 'w'); 

while( $row = fgetcsv( $in, 10000)){
  if( $row[5] > 2 ){
    fputcsv($out, $row);
  }
}

fclose($in); 
fclose($out);

unlink('original.csv');

rename('new.csv', 'original.csv');

row[5] is the column number where quantity is. It starts from row[0].

knacky

knacky

$in = fopen('original.csv', 'r');
$out = fopen('new.csv', 'w'); 

while( $row = fgetcsv( $in, 10000)){
  if( $row[5] > 2 ){
    fputcsv($out, $row);
  }
}

fclose($in); 
fclose($out);

unlink($in);

rename('new.csv', 'original.csv');

row[5] is the column number where quantity is. It starts from row[0].

×
×
  • Create New...