i have csv file contains username,firstname, and emails.
i want assign three variables from csv file seperately what i will do for that
this is code:
$fcontents = file('C:\Documents and Settings\winfo2\Desktop\user.csv');
# expects the csv file to be in the same dir as this script
for($i=1; $i<sizeof($fcontents); $i++) {
$line = trim($fcontents[$i]);
$arr = explode("\t", $line);
print_r( $arr);
how to assign csv data into three different variables
Moderator: General Moderators
-
prashantAG
- Forum Newbie
- Posts: 7
- Joined: Wed Apr 30, 2008 1:31 am
- Kieran Huggins
- DevNet Master
- Posts: 3635
- Joined: Wed Dec 06, 2006 4:14 pm
- Location: Toronto, Canada
- Contact:
Re: how to assign csv data into three different variables
try a combination of http://ca3.php.net/fgetcsv and http://ca3.php.net/list