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 "\n<table width=\"300\"><tr><td><input type=\"file\" name=\"textfile\"></td>";
  echo "\n\n<td 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 "<br>it worked";
      }
        else
           {
       echo "<br>it 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

Reply via email to