Sign in to follow this  
  • entries
  • comments
  • views

Workshop, Classes 6 and 7

Sign in to follow this  


This was an interesting week :D

We started class 6 by learning the structure of AJAX, wich its pretty simple and is like a recipe.

What is AJAX?

Is actually a library written in JavaScript not an entire new language. AJAX = Asinchronous Javascript And XML.

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 :D

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 :D

Sign in to follow this  


Recommended Comments

There are no comments to display.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now