Jump to content

Quick Question


LittlePie

Recommended Posts

Hay guys :) Just a quick question!I am making a website and wondering1) Is it better to use a config file with lots and lots of $[database_connect] or a table in the database?Any thoughts? because tbh..... i don't mind either :) just want it to be quicker for the end user! :)and now:2) How do u make a Config file with useing PHP!When you singe up for forums or anything really, You use a PHP Script to make a config.php file.... just wondering how i could make it :( thanks guys :)

Link to comment
Share on other sites

1) Is it better to use a config file with lots and lots of $[database_connect] or a table in the database?
For storing what? If the settings don't change very often a config file is faster, if you want to let someone change the settings a database is more convenient.
2) How do u make a Config file with useing PHP!
It's just a regular PHP file that defines variables. You include it on another page to have all of the variables defined.
Link to comment
Share on other sites

For storing what? If the settings don't change very often a config file is faster, if you want to let someone change the settings a database is more convenient.
I ment for storying anything, What one is generaly faster.
It's just a regular PHP file that defines variables. You include it on another page to have all of the variables defined.
What i mean is a file that will contain for exapel, database settings threw ur browers.
Link to comment
Share on other sites

Well, strictly in terms of performance, config files are faster to read. Config files are more difficult to update programmatically. If you're going to download the file, make changes, and upload the new file, that's fine. If you want a system where someone makes the changes in a browser and you need to save a new config file, it's not as easy as just storing those options in a database. That's why I said config files are generally better if the settings don't change very often. I store things like database connection information, system time zone, file paths, etc in config files because those don't need to change. I store things like user preferences in a database because I don't want to worry about writing and maintaining a config file for every user in the system. All general application data I also store in a database because it's much faster and less memory-intensive to look up a single piece of information in a database if you have several hundred thousand records. It would take a lot of server resources to try and load a file containing hundreds of thousands of records and find the one you're looking for. That's one of the things that databases are specifically meant for. If your data is related it also makes a lot more sense to store it in a relational database than a series of files.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...