Re: [Newbie Q] csv file upload via php to mysql tutorialrequest

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



1. learn how to do a file upload in PHP:
     http://www.php.net/manual/en/features.file-upload.php

2. Process the CSV file line by line in a loop.  Not posting your CSV file
format, I can only guess that it will be in proper form.  If so:

  for loop {
    $csvline = '"column1","column2","column3"';

    $r = mysql_query("insert into table values ($csvline)");
  }

This assumes the data in your CSV file is the same as your DB structure.
If not, do this:

    $r = mysql_query("insert into table (column1,column2,column3) values ($csvline)");

Peter

On Thu, 7 Nov 2002, kristina wrote:

> Hello listers
>
>   I am a complete newbie at this and I have searched for
>   anything that could help me understand this, but I've had
>   no luck.
>
>   My reason for emailing is this - I want
> to know how to
>   upload a csv file via php to a mysql
> database.  I have
>   found a few examples but they are all
> much to advanced for
>   my needs.  I just want the bear basics
> so I can understand
>   it.
>
>   I can see that phpMyAdmin does this,
> which is great but I
>   need it for joe public to be able to
> use.  so I don't
>   want them using phpMyAdmin.
>
>   Just a few links to some tutorials would
> be marvellous.
>
>   ;o)
>
> --
> tia as always
>
> bfn
> .kristina
>
> ml@kfxdesign.net
> kfxdesign.net
>
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>

---------------------------------------------------------------------------
Peter Beckman            Systems Engineer, Fairfax Cable Access Corporation
beckman@purplecow.com                             http://www.purplecow.com/
---------------------------------------------------------------------------


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux