Forums

PHP

This topic is locked

Importting flat / excel / text file to php msql???

Posted 16 Oct 2003 17:51:37
1
has voted
16 Oct 2003 17:51:37 adam test posted:
Importting flat / excel / text file to php msql???

Anyone know how to upload a flat file / excel spreadsheet / tab comma deliminnated text file to a MSQL database using php or a dreamweaver mxp extension?

I need a simple solution that a client can upload their products and inventory to established tables in a MySQL database.

I'm not a programmer so an all-in-one solution would help! Thanks.

Replies

Replied 27 Oct 2003 02:33:10
27 Oct 2003 02:33:10 Phil Shevlin replied:
Does the client have direct access to the db? phpMyAdmin has an import text file function. Otherwise here's a snippet from some code I use (comma delimited):

<pre id=code><font face=courier size=2 id=code>
$query = "LOAD DATA LOCAL INFILE '/your/path/data.txt' INTO TABLE your_table FIELDS TERMINATED BY ',' ENCLOSED BY '\"' LINES TERMINATED BY '\r\n'";
$result = mysql_query($query, $conn) or die(mysql_error());
</font id=code></pre id=code>

Reply to this topic