karthikeyansam / parsecsv-for-php

Automatically exported from code.google.com/p/parsecsv-for-php
MIT License
0 stars 0 forks source link

Remove a Row in CSV file #31

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
I have formulated a script that parses each row one by one. At the end of the 
script I would like to delete the row I execute with my function.

Steps
========
$csv = new parseCSV();
$csv->sort_by = 'Submitted';
$csv->conditions = 'A contains X';
$csv->offset = 1;
$csv->limit 1;
$csv->auto('file.csv');

$i=0;$i<999999;$i++;
$contact = $csv->data;

//Set various variable
$var = $contact[$i]["value"];

//Create Array
$arr = array('things' => $contact[$i]);

//Encode Array JSON
$string = json_encode($arr);

/cURL String

// cURL funtion here, does something Awesom!!!

echo 'Results rather Good or Bad';

// Here I would like to delete the row I just submitted
// So I can sleep the script and continue to process through the entire 
// CSV file

//Sleep for a few seconds and get the next row
sleep(4);

Original issue reported on code.google.com by mediaman...@gmail.com on 4 Dec 2013 at 5:38

GoogleCodeExporter commented 8 years ago
the script as it is right now works. But I have a large list to process, and 
had some issues automating the process. I attempted a foreach loop, but when I 
execute cURL function it would continue to cURL the same row, instead of 
cycling through each row.

I craeted variables, array and curl'd within the loop

foreach ($csv->data as $key) { .. functions here .. }

Original comment by mediaman...@gmail.com on 4 Dec 2013 at 5:43