Jump to content

Cannot crack this..


glenelkins

Recommended Posts

Im writing a script that should be simple but its becoming a pain. It reads a CSV file line by line, then splits the lines into an array (seperated by commas)

Here is the code
[code]
<?
/* CSV to MYSQL conversion utitliy */
/* Author: Glen Elkins */
/* 08/2006 */

// Set variables
define ("APP_PATH",".");
define ("CSV_FOLDER","/csv/");
define ("CSV_FILE","contacts.csv");

// Open The File
$csv_data = file(APP_PATH.CSV_FOLDER.CSV_FILE);

// Just read the first line to test
            echo $csv_data[0];  -  displays the first line: uid,email,valid,optin,source

            $line = $csv_data[0];
$exploded = explode("&#44;",$line);

echo $exploded[0]; - should display uid but displays uid,email,valid,optin,source

?>
[/code]

Can anyone see the problem?

Link to comment
https://forums.phpfreaks.com/topic/16385-cannot-crack-this/
Share on other sites

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.