1 00:00:00,420 --> 00:00:06,000 Now we are going to write our HP script to the Sibley database content, which is basically sensors 2 00:00:06,000 --> 00:00:10,840 reading and different values that we did pass using E.S.P. 3 00:00:11,340 --> 00:00:16,400 So let's create another picture before the public e-mail folder. 4 00:00:18,410 --> 00:00:22,220 So click here and let's name it E.S.P. 5 00:00:24,260 --> 00:00:26,930 Data not be. 6 00:00:29,580 --> 00:00:34,870 After creating the file click create, now we have it here, ESB data. 7 00:00:35,130 --> 00:00:41,460 What you need to do is simply click it and click edit to start editing your code. 8 00:00:41,820 --> 00:00:45,960 Now let's save our previous code and create a new file. 9 00:00:47,340 --> 00:00:50,010 Make sure that the syntax is BHP. 10 00:00:51,900 --> 00:01:00,390 Now, let's start writing, the first thing that you need to do is write the e-mail basic code so you 11 00:01:00,390 --> 00:01:03,980 can get it on code. 12 00:01:04,800 --> 00:01:11,040 And as you can see, this is the main line that you can write your ascherman. 13 00:01:11,490 --> 00:01:13,140 So you can simply copy this. 14 00:01:13,740 --> 00:01:23,700 I will give you that source code and I will provide links to download it and just copy from three schools. 15 00:01:24,690 --> 00:01:31,990 And base, this is basically Asham Alcalde, and here we have the body inside the body. 16 00:01:32,100 --> 00:01:43,650 We are going to create a HP code, so like PSP, and now we need to start writing our code and it will 17 00:01:43,650 --> 00:01:45,510 be very similar to our previous code. 18 00:01:45,510 --> 00:01:47,000 So let's move these two lines. 19 00:01:48,030 --> 00:01:51,180 We need first to copy this information. 20 00:01:54,030 --> 00:02:01,440 The server name, which is localhost the database, name, database, username, database, password, 21 00:02:02,100 --> 00:02:09,080 and let's say the code, let's call it ISP data display. 22 00:02:10,620 --> 00:02:18,060 OK, now that we since we have this code, we can change again, the syntax to PSP. 23 00:02:18,130 --> 00:02:23,020 I think that it did change it automatically to assume all because we wrote a Shyamal code. 24 00:02:23,340 --> 00:02:25,360 Now we can move to PSP again. 25 00:02:25,890 --> 00:02:31,620 Now, once you are done with routing your server name, database, name, username and password, you 26 00:02:31,620 --> 00:02:35,520 need to create a connection and check it again. 27 00:02:35,540 --> 00:02:41,370 We did that and this code so you can simply copy this great connection. 28 00:02:42,350 --> 00:02:43,860 And the tears. 29 00:02:44,460 --> 00:02:49,740 Now, the connection failed to connection, failed if you and any of this information along the way. 30 00:02:51,170 --> 00:02:58,640 After that, we need to create an actual variable and pass along the values. 31 00:02:59,360 --> 00:03:01,940 And to do that, we can simply. 32 00:03:02,850 --> 00:03:03,840 By the following. 33 00:03:06,330 --> 00:03:12,090 We write it that way here, but we write in a different way here, right? 34 00:03:13,590 --> 00:03:19,740 Do not ask you all then the equal sign here you need to write, select. 35 00:03:21,840 --> 00:03:22,440 Heidi. 36 00:03:24,250 --> 00:03:25,120 Sensor 37 00:03:27,520 --> 00:03:28,120 data. 38 00:03:30,480 --> 00:03:42,700 Location data value one value to value three and the reading time. 39 00:03:43,920 --> 00:03:51,660 These are basically the values that we want to grab from our database and write the database table that 40 00:03:51,660 --> 00:03:53,340 you need to read the data from. 41 00:03:53,370 --> 00:03:54,150 So from. 42 00:03:57,400 --> 00:04:00,600 And now you need to ride the table name. 43 00:04:00,640 --> 00:04:02,040 So let's go back here. 44 00:04:03,130 --> 00:04:06,640 Our table name is E.S.P. 45 00:04:06,640 --> 00:04:08,800 Thatta, so Cobbett E.S.P. 46 00:04:08,800 --> 00:04:15,750 Daughter, go back and right here, E.S.P data now, right. 47 00:04:15,760 --> 00:04:22,170 Order to order the data by I.D. in adequate order. 48 00:04:23,110 --> 00:04:23,580 Okay. 49 00:04:24,460 --> 00:04:28,390 Now this line is basically calling the I.D. from the database. 50 00:04:28,390 --> 00:04:29,940 That's called E.S.P data. 51 00:04:30,220 --> 00:04:31,310 It's calling IDs. 52 00:04:31,330 --> 00:04:37,990 And since all that location data value on value to value three and reading time from this database table, 53 00:04:38,440 --> 00:04:48,280 and it's ordering the values by already starting from the standard, basically from number one and moving 54 00:04:48,280 --> 00:04:51,960 on to number two, three, four, five and move on. 55 00:04:52,120 --> 00:04:58,480 Now, after doing that, we can equal the values we need to create a table to display data. 56 00:04:59,500 --> 00:05:08,200 And without going into details of that actual coding, since this is not unachievable or BHB coding 57 00:05:08,200 --> 00:05:11,440 course, you can simply copy my code. 58 00:05:11,830 --> 00:05:15,070 And this code is basically creating a table. 59 00:05:16,210 --> 00:05:25,450 As you can see it will has ID since all data location data value add value to Vilo three and timestamp. 60 00:05:25,460 --> 00:05:29,560 This will be the name of the columns and we will have all of these columns. 61 00:05:29,710 --> 00:05:34,300 As you can see, the spacing would be five and the padding will be five. 62 00:05:34,790 --> 00:05:40,340 Basically the space between Searls and in vertical and horizontal. 63 00:05:40,870 --> 00:05:45,550 Now, after creating the table, we need to start passing values to this table. 64 00:05:46,090 --> 00:05:53,470 And to do so, we need first to make sure that we have a connection to the database and call things 65 00:05:53,470 --> 00:05:54,090 by ID. 66 00:05:55,600 --> 00:06:00,850 Now, to do that, what you need to do is basically use this code. 67 00:06:00,880 --> 00:06:10,590 Now, if the result of the connection is through, then go and call the I.D. and assign it to the ideal 68 00:06:11,320 --> 00:06:16,840 called the census data and assigned to the sensor called location that and assigned to the location 69 00:06:17,140 --> 00:06:22,480 and call the values and assign them each to a different variable and BHB. 70 00:06:22,870 --> 00:06:30,450 Now the next step will be to equal these values and we can simply do that by using this code. 71 00:06:31,540 --> 00:06:38,650 We are going to equal each of the values that we did receive from the table into this table that we 72 00:06:38,650 --> 00:06:39,780 have created here. 73 00:06:40,390 --> 00:06:47,830 So it will print out the whole idea that all sensor data and location data that all value one, two, 74 00:06:48,130 --> 00:06:49,530 three and the reading time. 75 00:06:50,830 --> 00:06:56,920 Now, after doing all of this, we need to make sure that we are closing the connection that we attribute 76 00:06:56,920 --> 00:06:57,550 connection. 77 00:06:57,790 --> 00:07:00,100 So connection close. 78 00:07:00,100 --> 00:07:04,630 And this is the end tag for our PSP code, which is basically here. 79 00:07:05,140 --> 00:07:07,720 We open it here and we closed here. 80 00:07:09,870 --> 00:07:19,290 Now, after doing that, we need to make sure also to right the table that we created a table so we 81 00:07:19,290 --> 00:07:21,900 can simply add this tag. 82 00:07:24,620 --> 00:07:34,940 Here and this will flor's the table tag that we opened here and this area, as you can see, this is 83 00:07:34,940 --> 00:07:39,680 the opening of the table tag and this is the closing. 84 00:07:40,250 --> 00:07:46,850 Now, this is our code and I'm going to provide the code for you and this lecture resources so that 85 00:07:46,850 --> 00:07:47,540 you can use it. 86 00:07:47,900 --> 00:07:54,710 Just make sure that you edit the server name, the database name and the username and password to what 87 00:07:54,710 --> 00:07:56,540 you have on your website. 88 00:07:56,720 --> 00:07:57,830 Now select all. 89 00:07:59,460 --> 00:08:01,930 Could be the Cold War here. 90 00:08:03,370 --> 00:08:08,380 To your file manager, the code click, save and close. 91 00:08:09,560 --> 00:08:10,820 Now you are done. 92 00:08:13,050 --> 00:08:21,210 Now, if you try to access this code using very similar language, just like we did our previous example 93 00:08:22,710 --> 00:08:26,310 and we call E.S.P data, it's called E.S.P data. 94 00:08:31,900 --> 00:08:41,640 PSP, not all now, as you can see, we are receiving an error line 20, let's check for the error. 95 00:08:44,660 --> 00:08:51,800 OK, as you can see here, and our code line 20, there's a problem, which is basically we didn't in 96 00:08:51,800 --> 00:08:53,530 this line using a semicolon. 97 00:08:53,930 --> 00:08:59,840 So I had a simple on here, copy the code, go back edit tier. 98 00:09:02,040 --> 00:09:04,140 But what I provide you with the correct code. 99 00:09:05,200 --> 00:09:07,010 Now, check if there is any other error. 100 00:09:07,260 --> 00:09:13,630 OK, we have a problem with constructing connection line 14. 101 00:09:13,630 --> 00:09:16,700 As you can see, the connection failed and this was expected. 102 00:09:16,990 --> 00:09:24,810 I already told you that when you edit your database name, this is not the database name that's here. 103 00:09:25,720 --> 00:09:28,360 As you can see, this is our database now. 104 00:09:28,510 --> 00:09:35,140 So you need to copy this database name and based it on your code. 105 00:09:36,290 --> 00:09:42,140 It has the speed at which is the name that we did choose, but they usually add I.D. before that. 106 00:09:44,850 --> 00:09:46,160 OK, with me. 107 00:09:48,860 --> 00:09:49,710 Show us. 108 00:09:49,750 --> 00:09:57,830 OK, now this is the name for the database, but they added their own ID for protection, now for the 109 00:09:57,830 --> 00:09:58,580 user name. 110 00:09:58,610 --> 00:10:00,530 It's usually the same case. 111 00:10:01,250 --> 00:10:04,990 Now, let's check the user name for this database. 112 00:10:05,000 --> 00:10:07,310 As you can see, this is the database ID. 113 00:10:12,640 --> 00:10:19,120 And it has this table, it's called E.S.P data, so the table name is correct, we don't have to change 114 00:10:19,120 --> 00:10:20,380 it now. 115 00:10:21,140 --> 00:10:25,810 Now, usually you have to add the same prefix for the username. 116 00:10:25,810 --> 00:10:30,370 So we will go with this and we will post it here, as you can see. 117 00:10:30,400 --> 00:10:35,260 Now we have the idea, then the user name and let's go with the code. 118 00:10:36,740 --> 00:10:37,850 Let's put it this. 119 00:10:40,540 --> 00:10:43,540 Now, we can't base that here safe and close. 120 00:10:45,530 --> 00:10:47,000 If you refresh the page. 121 00:10:51,130 --> 00:10:51,940 Just go back. 122 00:10:54,760 --> 00:10:56,740 Based save on clothes. 123 00:10:59,640 --> 00:11:06,350 As you can see, the I.D. and Soledad, that location data value and value to value three and the timestamp. 124 00:11:06,750 --> 00:11:09,150 So our page is working just fine. 125 00:11:09,450 --> 00:11:10,560 And this page. 126 00:11:12,460 --> 00:11:14,710 The first one also needs to be modified. 127 00:11:15,220 --> 00:11:17,050 We need to edit these three lines. 128 00:11:18,500 --> 00:11:20,050 Let's go with them from here. 129 00:11:22,960 --> 00:11:32,560 And based them on our original code, which is this one, and let's based them here, the database USA 130 00:11:32,660 --> 00:11:41,710 and the database name need to be changed now, save and close and you are good to go now if you don't 131 00:11:41,710 --> 00:11:45,520 like to go and write the code yourself. 132 00:11:45,550 --> 00:11:52,540 You can simply copy our code and just edit the database and those of name and password and you are good 133 00:11:52,540 --> 00:11:53,000 to go. 134 00:11:53,050 --> 00:11:55,500 You can add more values and more variables. 135 00:11:55,510 --> 00:11:56,350 It's easy. 136 00:11:56,530 --> 00:12:06,530 You can simply add more values here using these lines and calling them using this line. 137 00:12:07,510 --> 00:12:13,060 So depending on your project or what you are trying to achieve, you can simply edit all of this code 138 00:12:13,390 --> 00:12:17,350 to fit your needs if you have any question about any line of code. 139 00:12:17,500 --> 00:12:18,500 I'm here to help you. 140 00:12:18,520 --> 00:12:24,730 Again, this is not appear to be Arashiyama cause that's why I didn't go into details of the BHB coding 141 00:12:24,730 --> 00:12:26,320 or shamal coding. 142 00:12:26,620 --> 00:12:32,140 You can simply copy and paste our code are provided for you and there's also a lecture. 143 00:12:32,980 --> 00:12:33,990 That's it for now. 144 00:12:34,030 --> 00:12:36,160 This is Ashara from Educational Engineering Team.