John Boy wrote: > Hi > > I want to upload a .csv file from my local pc to a mysql server. My local > machine is XP2. I have used the following but the file does not upload. When > using php MyAdmin it returns the error 'file not found'. Can anyone help? > > <?php > // Include our login information > include('db_login_master.php'); > // Connect - note: 'false' is 'no new link use existing' parameter and '128' > enables LOAD DATA > $connection = mysql_connect($db_host, $db_username, $db_password,false,128); > if (!$connection){ > die ("Could not connect to the database: > <br />". mysql_error()); > } > // Select the database > $db_select=mysql_select_db($db_database); > if (!$db_select) > { > die ("Could not select the database: > <br />". mysql_error()); > } > // Import new avaiability data from local CSV file > $sql2 = 'LOAD DATA LOCAL INFILE \'C:\\\\EXPORT.CSV\' INTO TABLE > `availability` > FIELDS TERMINATED BY \';\' ENCLOSED BY \'"\' ESCAPED BY \'\\\\\' > LINES TERMINATED BY \'\\r\\n\''; > // echo $sql2; > mysql_query($sql2); > echo '<p align="center"><font face="Verdana" color="#0000FF">'; > mysql_query($sql0); > printf("Records added: %d\n", mysql_affected_rows()); > > echo '<p align="center"><B>UPDATE COMPLETE</B></p>'; > > ?> > > Are you only passing the path to the "C:\\\\EXPORT.CSV" local file inside the query? You first need to upload the file. Either through a form or bu using FTP, SSH or something similar. More info about uploading files with PHP: http://php.net/manual/en/features.file-upload.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php