Now we are going to create one sample LAMP application, we are going to create one file Cat index
.php, then start of php code and end of php code.
Now we are going to first write that mean now we are not going to teach php how the PHP works.
so one code we have written that we will make available on the course page also.
this PHP, you can download that.
So in our case, the code is connection that we are using.
mysql connect, we are specifying on localhost connect.
as a annaya user, supply the password s Asdf#1234 and then connect to employee
database.
Then when we are going to perform the query and we are going to store it in q variable, select *
from salary limit 4.
When we want to fetch 4 records, then we want to store that mean.
We want to perform the mysql query by specifying connections string and then specifying the query.
Then we are going to use this while row mysql fetch array results.
Then we are going to display echo employee no, echo department.
Then we are going to specify echo salary.
Then we are going to close with so that each line is written in that mean there is break after each
line.
So that is the code we are going to write.
We are making available this code to you.
So why we have named that index.php because already we have discussed that the first page should
be index.php, in our case.
We are going to create this file offline.
So I will straightway show you this file.
So in your case, you can download from the course page this file and or you can type this code.
So in our case I will be creating this file offline to just save the time.
So then we will be using this code so that mean we are going to create one php application, which is going
to fetch 4 records from the database.
So it will be a complete example of our LAMP stack.
Again, we are keeping this application very simple because we need to understand the concept.
Once you have understood the concept, you can move into the complex application.
You can create complex type of database then for manipulating the data, you can write the application
according to that.