php-general Digest 28 Nov 2012 20:59:04 -0000 Issue 8052

Topics (messages 319755 through 319762):

Re: CSV importer tool
        319755 by: Marc Guay
        319756 by: Jim Lucas
        319757 by: Leandro Dardini
        319758 by: Ashley Sheridan
        319759 by: tamouse mailing lists
        319760 by: tamouse mailing lists
        319761 by: tamouse mailing lists

PDO question
        319762 by: admin.buskirkgraphics.com

Administrivia:

To subscribe to the digest, e-mail:
        php-general-digest-subscr...@lists.php.net

To unsubscribe from the digest, e-mail:
        php-general-digest-unsubscr...@lists.php.net

To post to the list, e-mail:
        php-gene...@lists.php.net


----------------------------------------------------------------------
--- Begin Message ---
This could help.  Searching for "php csv import to mysql" turned up a
lot of gold.

http://dev.mysql.com/doc/refman/5.0/en/load-data.html

--- End Message ---
--- Begin Message ---
On 11/27/2012 12:56 PM, Leandro Dardini wrote:
Hello,
I am going to write a PHP page to allow the client to upload a CSV file and
assign each column to one or more fields of a mysql table. Quite simple,
but I feel like I am reinventing the wheel... is it possible there is no
library to do it, maybe using AJAX or similar cute techniques?

Leandro


google for: php csv importer script

Reading the first result, it seems it is exactly what you are looking for.

--
Jim Lucas

http://www.cmsws.com/
http://www.cmsws.com/examples/

--- End Message ---
--- Begin Message ---
Thank you, but I was looking for a "cute" code... letting the user to swap
columns, ignore others, set the number of rows to initially jump, preview
data...

Leandro

2012/11/27 Jim Lucas <li...@cmsws.com>

> php csv importer script

--- End Message ---
--- Begin Message ---
On Tue, 2012-11-27 at 23:03 +0100, Leandro Dardini wrote:

> Thank you, but I was looking for a "cute" code... letting the user to swap
> columns, ignore others, set the number of rows to initially jump, preview
> data...
> 
> Leandro
> 
> 2012/11/27 Jim Lucas <li...@cmsws.com>
> 
> > php csv importer script


It shouldn't be too hard to code that. Most examples I've seen pull in
the first 1 or few records to aid the user as an example. Then they're
given a list of the possible fields to match against one by one.

Thanks,
Ash
http://www.ashleysheridan.co.uk



--- End Message ---
--- Begin Message ---
On Tue, Nov 27, 2012 at 2:56 PM, Leandro Dardini <ldard...@gmail.com> wrote:
> Hello,
> I am going to write a PHP page to allow the client to upload a CSV file and
> assign each column to one or more fields of a mysql table. Quite simple,
> but I feel like I am reinventing the wheel... is it possible there is no
> library to do it, maybe using AJAX or similar cute techniques?
>
> Leandro

This has been asked a few times, I wrote up a how-to and posted it on my wiki:

http://wiki.tamaratemple.com/Technology/UsingUploadedTempFilesToPopulateATableInPHP

It's such a few actual lines of code, I wonder if no one thinks it's
such a big deal to just write it over and over again. Basically it's
handled pretty much entirely in SQL rather than PHP.

--- End Message ---
--- Begin Message ---
On Tue, Nov 27, 2012 at 4:09 PM, tamouse mailing lists
<tamouse.li...@gmail.com> wrote:
> On Tue, Nov 27, 2012 at 2:56 PM, Leandro Dardini <ldard...@gmail.com> wrote:
>> Hello,
>> I am going to write a PHP page to allow the client to upload a CSV file and
>> assign each column to one or more fields of a mysql table. Quite simple,
>> but I feel like I am reinventing the wheel... is it possible there is no
>> library to do it, maybe using AJAX or similar cute techniques?
>>
>> Leandro
>
> This has been asked a few times, I wrote up a how-to and posted it on my wiki:
>
> http://wiki.tamaratemple.com/Technology/UsingUploadedTempFilesToPopulateATableInPHP
>
> It's such a few actual lines of code, I wonder if no one thinks it's
> such a big deal to just write it over and over again. Basically it's
> handled pretty much entirely in SQL rather than PHP.

Ah, sorry, in the time i was writing this our net went down, then came
back up, and I saw your earlier replies.

--- End Message ---
--- Begin Message ---
On Tue, Nov 27, 2012 at 4:11 PM, tamouse mailing lists
<tamouse.li...@gmail.com> wrote:
> On Tue, Nov 27, 2012 at 4:09 PM, tamouse mailing lists
> <tamouse.li...@gmail.com> wrote:
>> On Tue, Nov 27, 2012 at 2:56 PM, Leandro Dardini <ldard...@gmail.com> wrote:
>>> Hello,
>>> I am going to write a PHP page to allow the client to upload a CSV file and
>>> assign each column to one or more fields of a mysql table. Quite simple,
>>> but I feel like I am reinventing the wheel... is it possible there is no
>>> library to do it, maybe using AJAX or similar cute techniques?
>>>
>>> Leandro
>>
>> This has been asked a few times, I wrote up a how-to and posted it on my 
>> wiki:
>>
>> http://wiki.tamaratemple.com/Technology/UsingUploadedTempFilesToPopulateATableInPHP
>>
>> It's such a few actual lines of code, I wonder if no one thinks it's
>> such a big deal to just write it over and over again. Basically it's
>> handled pretty much entirely in SQL rather than PHP.
>
> Ah, sorry, in the time i was writing this our net went down, then came
> back up, and I saw your earlier replies.

Although on third thought, the technique of storing the entire CSV
uploaded in a temp table to let the user decide what to do with the
actual data has some possible use...

--- End Message ---
--- Begin Message ---
Guys,
I am not quiet sure what is happening but every time i try to connect to a
remote host it refers back to localhost.

$pdo = new PDO('mysql:host=171.16.23.44;dbname=test', 'user','password');

ERROR: Access denied for user 'user'@'localhost' (using password: YES) in
/var/www/html/text.php

Any clue as to WHY it keeps referring back to localhost when i clearly set the
host parameter to another server.
I checked the /etc/hosts records to see if there was a referral for that domain
back to it's self there is NOT.

--- End Message ---

Reply via email to