I'm building a simple script for a friend of mine and running into a question that I haven't been able to find a good answer for. I keep finding snippets of ideas here and there, and unfortunately it's not working for me.
Here is what I am trying to accomplish:
1) Use an HTML form to define variables
2) Use those variables to connect to a mysql server and create a new database
3) Save the variables and their input values (e.g. from an install script) to a file, but only after the database has been created - this makes sure the file is written only after a successful connection to the db server and creation of the correct database.
Basically, I want the variables for the server, user, password, and new database name saved to another .php file I can call on later for making database connections. My thought is to have them create a file that I can include into the scripts I use later so as not to re-create code every time, and yet allow the user to create their own database.
I'm sure this has been done several times, and I'm sure there are other projects out there that do this. However, I'm trying to learn and understand how this works as I create more and more scripts, so I want to write the code. I just need to know what type of technique I can use.
I've been playing with fopen, fwrite, and fclose.. but I'm having problems getting the syntaxes correct I think.