WEBVTT 00:05.060 --> 00:11.540 So far we manage to get details about our trip including the departure destination dates and time and 00:11.540 --> 00:12.470 so on. 00:12.560 --> 00:15.860 Now we go in to retrieve details about the driver. 00:15.860 --> 00:24.140 So to get details of the driver we're going to look at the trips table so you can see that we've got 00:24.470 --> 00:30.030 a user id call them referring to our drivers ID. 00:30.170 --> 00:36.410 So if we want to find information about the driver we need to get this user ID and then go to the users 00:36.410 --> 00:37.140 table. 00:37.460 --> 00:37.900 OK. 00:38.060 --> 00:42.080 And then look for details corresponding to that user. 00:42.410 --> 00:44.060 And that's what we're going to be doing. 00:44.750 --> 00:46.010 All right. 00:49.670 --> 00:55.350 So now first of all we're going to get the user id 01:04.930 --> 01:13.780 so to get the user id we are going to go back to the our row which shows the line that we are dealing 01:13.780 --> 01:14.500 with right now. 01:14.500 --> 01:17.350 Inside the results are objects and 01:20.640 --> 01:22.670 it is called personal I.D. 01:25.690 --> 01:34.340 and we we're going to go to the elements of key user ID. 01:35.770 --> 01:43.050 OK so now we've got the user id now to get information about this user. 01:43.130 --> 01:49.980 Will need to run another query to get this record from the users table. 01:50.350 --> 01:51.090 OK. 01:51.280 --> 01:51.670 So 01:56.610 --> 02:00.470 run the query to get you the details. 02:00.850 --> 02:04.870 So let's call our query is Cuil to. 02:05.920 --> 02:15.490 So you're going to select all records from the users table with a user id much so select all the records 02:16.150 --> 02:35.390 from our users table which is users and the condition is that we have a much of the user ID. 02:35.470 --> 02:38.560 OK so we're looking for one record. 02:38.560 --> 02:44.290 So a good proxy would be to add a limit to one any way it's going to return one record. 02:44.320 --> 02:45.440 OK. 02:45.550 --> 02:48.060 Even if you don't it means one. 02:48.070 --> 02:49.510 All right so now let's run. 02:49.550 --> 03:00.130 We're going to define a variable results or result to run the query using the function choli query. 03:00.490 --> 03:05.750 So again this will take a connection of variable and create. 03:06.670 --> 03:12.310 So once we run the query we were going to get the user details. 03:12.310 --> 03:23.120 So first let's check if the query is successful. 03:23.200 --> 03:29.620 Let's take the opposite. 03:29.700 --> 03:39.020 So when we run the first query we do the same. 03:39.050 --> 03:43.940 So again when we show the error we'll still show the error corresponding to the query for debugging 03:43.940 --> 03:44.570 purposes. 03:44.570 --> 03:45.570 OK. 03:45.770 --> 03:52.660 At the end you don't have to do this you can just show any error message you like OK without having 03:52.670 --> 03:56.720 to show the query the query itself and the error message. 03:56.720 --> 04:00.620 All right so once we do that's then if we skip this 04:03.900 --> 04:08.750 check that means that the query has run successfully. 04:09.540 --> 04:19.560 OK so now if the critter is successful then we're going to gets the record from the query. 04:19.950 --> 04:22.590 So we're going to use the function of my life history. 04:22.650 --> 04:30.000 So unlike in the previous case OK we're not going to have any one loop or anything like that because 04:30.000 --> 04:32.610 we're going to do that only once. 04:32.610 --> 04:41.310 So let's define a variable road to where we're going to store the record. 04:44.170 --> 04:44.880 OK. 04:45.290 --> 04:52.400 So inside this record we are going to have all the details we want about our driver including that first 04:52.400 --> 04:56.000 name genda comments and so on. 04:56.540 --> 05:00.810 OK so let's start with their first name. 05:05.840 --> 05:07.670 So that's going to be the elements 05:10.990 --> 05:12.550 of key first thing. 05:17.910 --> 05:20.740 All right so now let's move to the agenda 05:26.910 --> 05:28.860 you're looking at the elements of key 05:31.460 --> 05:31.860 gender 05:36.660 --> 05:44.840 then to get comments or more information about the driver Let's define a variable. 05:44.890 --> 05:45.760 More information 05:53.440 --> 05:58.900 and that will correspond to the elements of key information. 06:01.690 --> 06:02.130 OK. 06:02.150 --> 06:04.460 Now let's move to the picture 06:12.090 --> 06:16.010 that's going to be profile picture. 06:17.580 --> 06:22.740 And we also need the phone number. 06:23.420 --> 06:30.810 All right now regarding the phone number we're going to check if the user is logged in or not. 06:30.820 --> 06:31.350 OK. 06:31.510 --> 06:35.170 If you use these looks and we're going to show the phone number otherwise we're not going to show the 06:35.260 --> 06:35.940 phone number. 06:35.980 --> 06:39.250 So we should check if a user is logged in. 06:39.250 --> 06:40.990 We are going to check the session variable 06:44.210 --> 06:46.870 user ID. 06:47.600 --> 06:54.190 OK so you can do this like this or use the reset function. 06:54.370 --> 06:55.770 And we'd like that for now. 06:55.790 --> 07:01.510 So if the user is locked in then we're going to set the phone number 07:04.400 --> 07:07.350 variable to the phone number of the user. 07:07.420 --> 07:14.300 So to get the phone number of the user We're going to access the elements of key phone number. 07:15.530 --> 07:18.320 That's if the user is locked in. 07:18.380 --> 07:23.600 Otherwise we will just set the phone number 07:30.660 --> 07:31.500 to a 07:34.400 --> 07:39.720 message saying something like Please sign up. 07:39.740 --> 07:40.830 OK. 07:43.770 --> 07:44.970 So if I logout 07:53.080 --> 07:59.590 and see just the text we want to show. 07:59.610 --> 08:00.210 All right. 08:00.330 --> 08:05.300 So now we've got all details that we want about our user. 08:05.490 --> 08:11.520 So now we are ready to print our trip using the trip details and the user details. 08:11.790 --> 08:12.130 OK. 08:12.150 --> 08:14.450 So let's go ahead and do this. 08:22.890 --> 08:28.580 So we're going to echo some HMO code. 08:28.600 --> 08:29.080 All right. 08:29.080 --> 08:31.090 So we will continue in the next with you.