Load data infile problem

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

 



Hello, 
 
I have a page with a button that when clicked loads a pre-determined
text file into my database. The code is posted below.
However, when clicked the button does nothing, just opens up the same
page again. The data does not get loaded into the database. any ideas?
 
Thanks
Justin
 
The page is viewall.php which has the button on it. So I want it (when
clicked) to update the database and return to the page.
 
 
 
<td width="100%" align="center">
      
<?php
if ($submit) {
    $dbH = mysql_connect('localhost', 'root', 'password') or die('Could
not connect to MySQL server.<br>' . mysql_error());
 
    mysql_select_db("options");
 
    $sql = 'LOAD DATA INFILE \'C:\\\\abc.txt\' REPLACE INTO TABLE `abc`'
        . 'FIELDS TERMINATED BY \'\\t\''
        . 'ENCLOSED BY \'"\''
        . 'ESCAPED BY \'\\\\\''
        . 'LINES TERMINATED BY \'\\r\\n\'';
}
?> 
 
<?php
$d = "<form method=post action='viewall.php'>". "<input type=submit
name=submit value='Submit'></form>";
echo "$d"; ?>
</td>

[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux