PHP Developers Network

A community of PHP developers offering assistance, advice, discussion, and friendship.
 
Loading
It is currently Sat Nov 18, 2017 10:54 am

All times are UTC - 5 hours




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: Import CSV File
PostPosted: Sat Jul 02, 2011 1:29 pm 
Offline
Forum Newbie

Joined: Sat Jul 02, 2011 12:58 pm
Posts: 5
I added some code to import a csv file.

I'm sharing it here as well as mycsv import function:

Syntax: [ Download ] [ Hide ]

function importCSV {
$handle = fopen("file.csv", 'r');
while(($data = fgetcsv($handle, 1000, ",")) !== false)
{
    list($col1, $col2, ...) = $data;
}
fclose($handle);
}

 


Top
 Profile  
 
 Post subject: Re: Import CSV File
PostPosted: Sat Jul 02, 2011 4:58 pm 
Offline
DevNet Resident
User avatar

Joined: Wed Apr 01, 2009 1:31 pm
Posts: 1531
There are two syntax errors:
  • invalid function definition (no parameter list)
  • invalid list() syntax (pseudo-code?)
The function has no inputs, no output, and no useful side-effects; so what is the purpose?


Top
 Profile  
 
 Post subject: Re: Import CSV File
PostPosted: Mon Nov 21, 2011 6:42 am 
Offline
Forum Newbie

Joined: Thu Nov 10, 2011 5:46 am
Posts: 3
I've been searching for a while now but can't seem to find answers so here goes...

I've got a CSV file that I want to import into a table in Oracle (9i/10i).

Later on I plan to use this table as a lookup for another use.

This is actually a workaround I'm working on since the fact that querying using the IN clause with more that 1000 values is not possible.

How is this done using SQLPLUS?


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC - 5 hours


Who is online

Users browsing this forum: No registered users and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
Powered by phpBB® Forum Software © phpBB Group