Jump to content


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


Cannot crack this..

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
/* 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


Can anyone see the problem?

Share this post

Link to post
Share on other sites
oh! it does not. for some reason that didnt work before ...

Share this post

Link to post
Share on other sites


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.