Now we are going to write our HP script to the Sibley database content, which is basically sensors
reading and different values that we did pass using E.S.P.
So let's create another picture before the public e-mail folder.
So click here and let's name it E.S.P.
Data not be.
After creating the file click create, now we have it here, ESB data.
What you need to do is simply click it and click edit to start editing your code.
Now let's save our previous code and create a new file.
Make sure that the syntax is BHP.
Now, let's start writing, the first thing that you need to do is write the e-mail basic code so you
can get it on code.
And as you can see, this is the main line that you can write your ascherman.
So you can simply copy this.
I will give you that source code and I will provide links to download it and just copy from three schools.
And base, this is basically Asham Alcalde, and here we have the body inside the body.
We are going to create a HP code, so like PSP, and now we need to start writing our code and it will
be very similar to our previous code.
So let's move these two lines.
We need first to copy this information.
The server name, which is localhost the database, name, database, username, database, password,
and let's say the code, let's call it ISP data display.
OK, now that we since we have this code, we can change again, the syntax to PSP.
I think that it did change it automatically to assume all because we wrote a Shyamal code.
Now we can move to PSP again.
Now, once you are done with routing your server name, database, name, username and password, you
need to create a connection and check it again.
We did that and this code so you can simply copy this great connection.
And the tears.
Now, the connection failed to connection, failed if you and any of this information along the way.
After that, we need to create an actual variable and pass along the values.
And to do that, we can simply.
By the following.
We write it that way here, but we write in a different way here, right?
Do not ask you all then the equal sign here you need to write, select.
Heidi.
Sensor
data.
Location data value one value to value three and the reading time.
These are basically the values that we want to grab from our database and write the database table that
you need to read the data from.
So from.
And now you need to ride the table name.
So let's go back here.
Our table name is E.S.P.
Thatta, so Cobbett E.S.P.
Daughter, go back and right here, E.S.P data now, right.
Order to order the data by I.D. in adequate order.
Okay.
Now this line is basically calling the I.D. from the database.
That's called E.S.P data.
It's calling IDs.
And since all that location data value on value to value three and reading time from this database table,
and it's ordering the values by already starting from the standard, basically from number one and moving
on to number two, three, four, five and move on.
Now, after doing that, we can equal the values we need to create a table to display data.
And without going into details of that actual coding, since this is not unachievable or BHB coding
course, you can simply copy my code.
And this code is basically creating a table.
As you can see it will has ID since all data location data value add value to Vilo three and timestamp.
This will be the name of the columns and we will have all of these columns.
As you can see, the spacing would be five and the padding will be five.
Basically the space between Searls and in vertical and horizontal.
Now, after creating the table, we need to start passing values to this table.
And to do so, we need first to make sure that we have a connection to the database and call things
by ID.
Now, to do that, what you need to do is basically use this code.
Now, if the result of the connection is through, then go and call the I.D. and assign it to the ideal
called the census data and assigned to the sensor called location that and assigned to the location
and call the values and assign them each to a different variable and BHB.
Now the next step will be to equal these values and we can simply do that by using this code.
We are going to equal each of the values that we did receive from the table into this table that we
have created here.
So it will print out the whole idea that all sensor data and location data that all value one, two,
three and the reading time.
Now, after doing all of this, we need to make sure that we are closing the connection that we attribute
connection.
So connection close.
And this is the end tag for our PSP code, which is basically here.
We open it here and we closed here.
Now, after doing that, we need to make sure also to right the table that we created a table so we
can simply add this tag.
Here and this will flor's the table tag that we opened here and this area, as you can see, this is
the opening of the table tag and this is the closing.
Now, this is our code and I'm going to provide the code for you and this lecture resources so that
you can use it.
Just make sure that you edit the server name, the database name and the username and password to what
you have on your website.
Now select all.
Could be the Cold War here.
To your file manager, the code click, save and close.
Now you are done.
Now, if you try to access this code using very similar language, just like we did our previous example
and we call E.S.P data, it's called E.S.P data.
PSP, not all now, as you can see, we are receiving an error line 20, let's check for the error.
OK, as you can see here, and our code line 20, there's a problem, which is basically we didn't in
this line using a semicolon.
So I had a simple on here, copy the code, go back edit tier.
But what I provide you with the correct code.
Now, check if there is any other error.
OK, we have a problem with constructing connection line 14.
As you can see, the connection failed and this was expected.
I already told you that when you edit your database name, this is not the database name that's here.
As you can see, this is our database now.
So you need to copy this database name and based it on your code.
It has the speed at which is the name that we did choose, but they usually add I.D. before that.
OK, with me.
Show us.
OK, now this is the name for the database, but they added their own ID for protection, now for the
user name.
It's usually the same case.
Now, let's check the user name for this database.
As you can see, this is the database ID.
And it has this table, it's called E.S.P data, so the table name is correct, we don't have to change
it now.
Now, usually you have to add the same prefix for the username.
So we will go with this and we will post it here, as you can see.
Now we have the idea, then the user name and let's go with the code.
Let's put it this.
Now, we can't base that here safe and close.
If you refresh the page.
Just go back.
Based save on clothes.
As you can see, the I.D. and Soledad, that location data value and value to value three and the timestamp.
So our page is working just fine.
And this page.
The first one also needs to be modified.
We need to edit these three lines.
Let's go with them from here.
And based them on our original code, which is this one, and let's based them here, the database USA
and the database name need to be changed now, save and close and you are good to go now if you don't
like to go and write the code yourself.
You can simply copy our code and just edit the database and those of name and password and you are good
to go.
You can add more values and more variables.
It's easy.
You can simply add more values here using these lines and calling them using this line.
So depending on your project or what you are trying to achieve, you can simply edit all of this code
to fit your needs if you have any question about any line of code.
I'm here to help you.
Again, this is not appear to be Arashiyama cause that's why I didn't go into details of the BHB coding
or shamal coding.
You can simply copy and paste our code are provided for you and there's also a lecture.
That's it for now.
This is Ashara from Educational Engineering Team.