Keiran,
in your second page, you refer to $textfile as the thing that you want to
load into the database; this file doesn't exist on the server, so it is
inserting nothing I would imagine.
You need to use something like $_FILES['tmp_name'] to refer to the actual
file, once it has been successfully uploaded to your server
(http://www.php.net/manual/en/features.file-upload.php#features.file-upload.
post-method)
HTH
Beau
// -Original Message-
// From: Keiran Wynyard [mailto:[EMAIL PROTECTED]]
// Sent: Tuesday, 11 June 2002 12:38 AM
// To: [EMAIL PROTECTED]
// Subject: [PHP-DB] CSV/TXT file imported via PHP into MySQL
//
//
// I have a form on a PHP page with which I wish to load a tab
// delimited text file into a
// UNIX based MySQL database
//
// By using PHPMyAdmin I have tested whether I can upload the
// file, using MyAdmin to help me
// construct the Query and to date in MyAdmin it works fine.
// Taking the query and splitting
// it across two pages (one for receiving the file, and to
// action the query) seems to stop it
// from working.
//
// I have detailed the pertinent aspects below.
// My question is really to do with whether there is a file
// permissions setting or
// requirement that I have to be aware of, or if there is
// merely something else I can do.
//
// Form code:
// echo form method=\post\ action=\$PHP_SELF?command=create\
// enctype=\multipart/form-data\;
// echo \ntable width=\300\trtdinput type=\file\
// name=\textfile\/td;
// echo \n\ntd width=\50\input type=\submit\
// name=\submit\ value=\Load
// File\/td/tr/table/form;
//
// Query section:
// switch ($command)
// {
// case 'create':
// echo br$textfile; \\merely existing to run checks
// $query = LOAD DATA LOCAL INFILE ' . $textfile
// . ' INTO TABLE
// pebble_email_addresses FIELDS TERMINATED BY '\t' LINES
// TERMINATED BY '\r\n' (firstname,
// surname, email) ;
// echo br$query; \\merely existing to run checks
// $sql_query_result = @mysql_query($query, $sql_userdb);
// if ($sql_query_result and @mysql_affected_rows() 0)
// {
// //Worked OK
// echo brit worked;
// }
// else
//{
//echo brit didn't;
// break;
//
// I have yet to get the damn query to import anything at all! HELP
//
// Thanks in Advance!
//
// Keiran
//
//
//
// --
// PHP Database Mailing List (http://www.php.net/)
// To unsubscribe, visit: http://www.php.net/unsub.php
//
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php