Hi,

I am currently using MySQL 4.0.14-standard along with PHP 4.3.2 in Apache 1.3.28.

I have written following code to upload some data from the hosting directory to database table. But LOAD DATA statement always fails. I have checked the same SQL using Sql-Front. It is showing Access denied. But table is creating, data is not loading using same connection.

Please help me by telling what has happened wrong.

My code :
<?php
 echo "<HTML>";
 echo "<BODY>";

   $dbname = "biplab";
   $dbserver = "localhost";
   $dbuser = "sumit";
   $dbpassword = "xx329x";

   $connect=mysql_connect($dbserver,$dbuser,$dbpassword)
            or die("could not connect to MySQL server in localhost !");
   $database=mysql_select_db($dbname) or die("could not select database");

$tablename="AIS_COURSES";

   $query="DROP TABLE $tablename";
   $result=mysql_query($query);

   $query="CREATE TABLE $tablename
          (CRS_CODE VARCHAR(10) NOT NULL
          ,CRS_NAME VARCHAR(80) NOT NULL
          )";

$result=mysql_query($query) or die("Create Table $tablename failed");

$query="Load Data Infile './BUWebCourses.txt'
INTO TABLE $tablename Fields Terminated By '|' (CRS_CODE,CRS_NAME)" ;


echo $query; //just to check

$result=mysql_query($query) or die("Load Table $tablename failed");

echo "<H4 Align='center'>Table $tablename has been updated successfully.</H3>";



mysql_close();

 echo "</HTML>";
 echo "</BODY>";

?>

Thanks in advance

Sumit





--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]



Reply via email to