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?
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">
if ($submit) {
    $dbH = mysql_connect('localhost', 'root', 'password') or die('Could
not connect to MySQL server.<br>' . mysql_error());
    $sql = 'LOAD DATA INFILE \'C:\\\\abc.txt\' REPLACE INTO TABLE `abc`'
        . 'FIELDS TERMINATED BY \'\\t\''
        . 'ENCLOSED BY \'"\''
        . 'ESCAPED BY \'\\\\\''
        . 'LINES TERMINATED BY \'\\r\\n\'';
$d = "<form method=post action='viewall.php'>". "<input type=submit
name=submit value='Submit'></form>";
echo "$d"; ?>

Reply via email to