Now that you understand a little more about hosting, let’s talk a little more about your files and folders that make up your site and how they work to be able to gather data and disseminate or give out data to your users. You already know your files “talk” to one another via code.
Not only do your files talk to one another, they talk with your databases too. Databases hold all of the details that you might collect from your user as well as content you have entered for display to your users. The files only grab what they need from the batabases at any particular moment and display that to your user only when or if it is needed. Just as the databases will only give the files the information they call for, no more.
Here is an example. A user goes to your site. They see your home page because they typed your url. The computer recognized the address and accesses the file that you specified as the home page. Let’s say the user has to sign in (they have previously completed the registration process). The user clicks “login” and the files talk and the files containing the code to allow the user to add their username and password are “called”. Now the user adds their information. While the file are talking, they realize they don’t have the information within themselves and the call the database to find the stored information. The database says, “well, I don’t know about users but I know that I have data that matches this username with the input field, and this data for this password in that input field and when I get a match, I can allow the file to proceed with their next task.” The database sends the message to the file and the file then takes the information and displays the correct response back to the user indicating that he/she has successfully signed in. It just works in reverse to get new information into the database.
The example might not be technically accurate but it does give you the general idea and hopefully some insight to be able to better understand.