Don't give up on MySQL. Forget the txt files. With your skills, MySQL is going to be crucial for what you want to do. You can get cheap web hosting with MySQL for learning purposes for $6 US per month.
You don't create a "MySQL file". You create a PHP script and you invoke MySQL from inside PHP. Use one command to connect to the database, another command to insert data into tables, another to extract data, and another to alter data.
You could use a txt file (with the fopen, fread, and fwrite commands) but that's taking a huge step backwards. MySQL is fast even when you get millions of records in the database - a txt file would be a nightmare to control once you got just a few thousand records.
Here's an example of what PHP code might look like to do the sample application you described above:
First, write an HTML page with a form to get the variable to write to the database:
<html>
<head><title>Test</title></head>
<body>
<form action="page2.php" method=post>
Enter something: <input type=text name="message">
<input type=submit value="Go!">
</form>
</body>
</html>
save that html file as "input.html" or something like that.
Now write this PHP file. The form above points to this file. (When the user clicks "Go", the contents of the form are passed to this next script... so the next script has to be called "page2.php").
<?php
// first, connect to the database
mysql_connect("localhost","username-here","password-here");
@mysql_select_db("database-name-here") or die( "Unable to select database");
// Capture the passed value to a variable:
$message = $_POST['message'];
// These two lines make sure that the table is empty which
// You want to do for this application where there should only be one message
$query = "delete from message";
$result = MYSQL_QUERY($query);
// Now that the table is empty, you can insert this new message
$query = "insert into message_table (message) values ('$message')";
$result = MYSQL_QUERY($query);
print "Your message has been written to the database";
?>
Now, the owner of the web site can visit the form and insert a message into the table whenever they want.
Now you make your home page look like this:
<?php
// first, connect to the database
mysql_connect("localhost","username-here","password-here");
@mysql_select_db("database-name-here") or die( "Unable to select database");
// Get the message from the table
$query = "select message from message_table";
$result = MYSQL_QUERY($query);
$message = list($message) = @mysql_fetch_row($result);
?>
<html>
<head><title>This is the home page</title></head>
<body>
Hi, and <b>welcome</b> to our page.<p>
Today's message is <?php print "$message"; ?>
</body>
</html>
obviously, that last script should be called index.php
This particular example is a little weird because it assumes that there will always be exactly ONE record in the table. And that's fine but it's not normally the case. Usually, you will keep adding more records (like a customers table) but you can move on to that in the next lesson 🙂