This was an interesting week
We started class 6 by learning the structure of AJAX, wich its pretty simple and is like a recipe.
What is AJAX?
What does it do?
It does auto-refresh of your page, you have to give AJAX the page that has to be refreshed, and he takes care of calling it over and over again, Its mostly used for dynamic pages together with PHP.
After that we learned a bit about MySQL, but not much, since we all knew SQL, and they are very similar, there is just some slight differences, if you want to learn it, is really simple.
Then PHP, the language that makes a dynamic site work
We learned about the language syntax and its behaviour.
In Class 7 we continued with PHP, did some examples like "Hello World" (a classic), learned about the different variables in PHP, the local ones, created by the $ sign and the external, that are already created, and waiting to be loaded with data, this ones are: $_GET, $_POST, $_SESSION and $_COOKIE. This external variables are arrays used to pass data from one page to another.
The $_POST variable, only works with HTML forms, or AJAX, but what if you dont want to use a form, you want to use your own buttons?, then you can use the $_GET array, you can load it yourself by adding the data to the page address (ex: page.php?data = value&...), but its a security risk, since eveyone can see the data in the address bar, maybe for some data it doesnt matter, but what if you are making a login?, you dont want that data to be visible, this is were the $_SESSION is usefull, you use this array to make a login and keep the login open by passing the data in this array from one page to another.
Then the teacher showed us how to reuse code.
For example if you have the same menu in every page, instead of copying it in every page, you just do the code in a separate page (.html or .php) and you include it where you want it to be by using the php function include(url).
There are different ways to include a file:
include(): includes the file, but if it doesnt exist, the page continues to load.
require(): includes the file, but if it doesnt exist, the page stops loading.
A good programming practice is to add _once between the include/require and the (), that is to avoid a double include.
We have 2 more classes, but now i can almost finish the project