-1

Hello any ideas or suggestion how to make conversion my .csv text to table?

Check this link for reference: http://vis.stanford.edu/wrangler/app/

pnuts
  • 58,317
  • 11
  • 87
  • 139
  • 1
    take a look at this SO answer: http://stackoverflow.com/questions/1269562/how-to-create-an-array-from-a-csv-file-using-php-and-the-fgetcsv-function – Criesto Sep 09 '15 at 11:22
  • 1
    There are either too many possible answers, or good answers would be too long for this format. Please add details to narrow the answer set or to isolate an issue that can be answered in a few paragraphs.I would suggest that you find a development forum (perhaps [quora](http://www.quora.com/Computer-Programming)?) to work out generalities. Then, when/if you have specific coding issues, come back to StackOverflow and we'll be glad to help. – Jay Blanchard Sep 09 '15 at 12:16

1 Answers1

3

You can browse your .csv with fgetcsv and use foreach to browse the array returned. You simply displays the result.

Here is an exemple :

// Open the file with PHP
$oFile = fopen('PATH_TO_FILE', 'w');

// Get the csv content
$aCsvContent = fgetcsv($oFile);

// HTML Table
echo '<table>';

// Browse your csv line per line
foreach($aCsvContent as $aRow) {

    // New table line
    echo '<tr>';

    // Browse your line cell per cell
    foreach($aRow as $sContent) {

        // New cell with the content
        echo '<td>'.$sContent.'</td>';
    }

    // End the line
    echo '</tr>';
}

// Close the HTML Table
echo '</table>';

// Close you file
fclose($oFile);

I have done this 3 weeks ago ^_^

If you have a problem, tell me. Maybe I can help you !

SatanicGeek
  • 342
  • 5
  • 15
  • $aXXXX = array, $sXXXX = string, $oXXXX = object – SatanicGeek Sep 09 '15 at 11:33
  • Hello, Thank you for a help.But I already try this but I want to convert data into a table in a different way. Which is copy data from excel/csv and paste into textbox of my page and have a button to convert it into a table Which is similar concept into this link http://vis.stanford.edu/wrangler/app/ – Carlvic Japitana Lim Sep 10 '15 at 05:59
  • Well, try this [http://php.net/manual/fr/function.str-getcsv.php](http://php.net/manual/fr/function.str-getcsv.php) – SatanicGeek Sep 10 '15 at 09:19