LOAD INFILE

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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>';

?>


-- 
John
UK 



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux