Now we are going to write our script to the Sibley database content, which is basically essential reading
and different values that we did pass using ESB.
So let's create another PSP file in the Public Assemble folder.
So click here and let's name it, ESB.
Data dot hp.
After creating the file, click Create.
Now we have it here.
USB data.
What you need to do is simply click it and click it to start editing your code.
Now, let's save our previous code and create a new file.
Make sure that the syntax is PSP.
Now, let's start writing, the first thing that you need to do is provide the additional basic chords
so you can get it simple chords and as you can see, this is the main line that you can write, you
know?
So you can simply comedies.
I will give you that source code and I provide links to download it and just copy from three schools.
And paste, this is basically a simple chords.
And here we have the body inside the body.
We are going to create a record.
So like PSB and now we need to start writing our code and it will be very similar to our previous court.
So let's move these two lines.
We need first to copy this information.
The server name, which is localhost, the database name, database, user name, database, password,
and let's say the codes, let's call it the ISP data the supplier OK, now that we since we have this
code, we can't change again the syntax to PSP.
I think that it did change it automatically to us all because we wrote a simple code.
Now we can move to Patch B again.
Now, once you are done with, I think, your server name, database, name, username and password,
you need to create a connection and check it again.
We did that in this code, so you can simply copy this create connection.
And burst to tears.
Now the connection further to apparent connection failed if you entered any of this information.
After that, we need to create a secure all variable and pass along the values.
And to do that, we can't simply.
By the following.
We write it that way here, but we were not different, we're here right now.
Ask you all, then they will sign here.
You need to write, select.
I'd.
Sensor
data.
Location data value one, value two, value three.
And the reading time.
These are basically the values that we want to grab from our database and find the database table that
you need to read the data from.
So from.
And now you need to ride the table now.
So let's go back here.
Our table name is your speed data.
So Kobe ISP data, go back and talk to your ISP data now, right?
Order to order the data by I.D. and adequate or OK.
Now this line is basically calling the idea from the database that's called ISP data.
It's calling it since all data location data value one, Value two, value three and reading time from
this database table and it's all done and the values by already starting from the what sounds like basically
the phone number one and moving on to number two, three, four, five and more.
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 Jamal coding.
Since this is not an simple or BHP coding course, you can simply call my code on.
This code is basically creating a table.
As you can see, it will has ID sensor data, location data value one value provide a three and timestamp.
This would be the name of the columns, and we will have all of these columns.
As you can see, the salesperson would be five on the sill.
Padding would be five.
It's basically the space between cells and in vertically and horizontally.
Now, after creating the table, we need to start parsing 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
call the sensor data and assigned to the sensor, call the location data and assigned to the location
and call the values and assign them each to a different variable and BHP.
Now the next step will be to equal these values, and we can't simply do that by using this code.
We are going to equal each of the values that we did receive from the table until this table that we
have created here.
So it will print out the Real ID that all sensor that that location data that will 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, the BHP connection.
So connection clause.
This is the end tag for our PSP code, which is basically here.
We open it here and we close to.
Now, after doing that, we need to make sure also to right the table that we created a table so we
can simply this thug.
Here on this one floors, the tables tag that we opened here and this area, as you can see, this is
the opening of the table tag.
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 the server name, the database name and the username and password to what you have
your website.
Now select all.
Kobe, the Cold War here.
To your file manager, paste the code, click save and close.
Now you are done.
Now, if you try to access this code using very similar link, just like we did our previous example
and we'll call you speed data, it's called the speed data.
OK, yes.
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 column here.
Copy the code.
Go back edit tier.
Don't what I provide you with the correct codes.
Now, check if there is any other error.
OK, we have a problem with constructing connection line 14, as you can see, connection failed.
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 name, so you need to copy this database name and based it on
your records.
It has a speed that which is the name that we did choose.
But they usually add I.D. before that.
OK.
Let me.
So.
OK, now this is the name of our database, but they added their own ID for protection now for their
username.
It's usually the same case.
Now let's check the use of name for this database.
As you can see, this is the Database ID.
And it has this table, it's called SB 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 those other names.
So we will cope with this and we will base that here.
As you can see, now we have the idea, then the user name and let's go the code.
Let's put it this.
No, we can base that here safe and close.
Few refresh the page.
OK, just go back.
Based save and close.
As you can see, the ads and Soledad are location data value and value to value three and the time stamp.
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 copy them from here.
And this our original code, which is this one.
And let's face them here, the database is something that at the base 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 adjust
it.
Did the database and the username 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 the squad
to fit your needs if you have any question about any line of code.
I'm here to help you.
Again, this is not Apache or national calls.
That's why I didn't go into details of the BHP Coding or Oshiomole coding.
You can simply copy and paste our code and provide it for you and the results of the lecture.
That's it for now.
This is Ashraf from educational engineering team.