CSV Import to MySQL through PHP

I love PHPMyAdmin, but I want something a little more "secure" that I can setup for an average user.  Even something that will import a file from the same location over and over by pressing a button.

The file is CSV file with one strange twist.  One field has several filenames separated by | though like I said, it is a single field called attachments.

Anyone know of any software or good script to modify that could provide this functionality?
Who is Participating?
Ray PaseurConnect With a Mentor Commented:
PHP has a built-in function that may be helpful:

You can isolate the filenames that are "pipe-delimited" and get an array with this sort of thing.  The trim() is there in case you get stray whitespace.

HTH, ~Ray
$attch = 'file.one|file.two | file.tre| file.for';
$array = explode('|', $attch);
foreach ($array as $pointer => $thing) { $array[$pointer] = trim($thing); }

Open in new window

it is a fairly easy proccess to parse a CSV file into its seperate fields and then upload them to a table. Take a look at the explode() function...


Using explode() you can  parse your CSV record into an array. Then traverse the array in a loop and build your upload statement. Post a sample of your file and I will write a quick example script.

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

The second article shobinsun gave you is an example of what I was saying. I didn't see he had posted before I posted.

hydraziAuthor Commented:
Awesome!  Thank you
Ray PaseurCommented:
Thanks for the points!  It's a good question. ~Ray
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.