Load data infile problem
| From: | Justin dot Baiocchi at csiro dot au | Date: | Tue, 08 Jun 2004 01:17:32 +0000 |
| Subject: | Load data infile problem | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-34677@lists.php.net to get a copy of this message | ||
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>