The above code is just an example. You need to rewrite the code suitable for output, and the code
needs to be inserted in every file.
In your php or html files, if the output codes are calling data from your database, you need
to insert the data getting from .txt file into your database table. In other words, if you
insert/update the data in your table, 6 different files will also be updated accordingly
at once. The following example shows how to insert data getting from .txt file:
PHP Code:
<?php
$conn = mysql_connect("mysql8.000webhost.com", "a336xxxx_test","******") or die(mysql_error());
mysql_select_db("a336xxxx_test", $conn);
$fp=fopen("contact.txt","r");
while(!feof($fp)) {
$contact=fgets($fp);
list($firstname, $lastname, $email, $phone) = explode("\t", $contact);
$firstname = trim($firstname);
$lastname = trim($lastname);
$sql = "insert into table_name (firstname, lastname) values ('$firstname', '$lastname')";
$result = mysql_query($sql);
// if data are not inserted
if(!$result) echo "Database error!";
}
?>