1 00:00:00,690 --> 00:00:01,350 Welcome back. 2 00:00:01,680 --> 00:00:04,530 Now it's time to work on editing the product. 3 00:00:04,540 --> 00:00:10,230 So here, if you if a user clicks on edit of a specific product, for example, this product, they 4 00:00:10,230 --> 00:00:12,060 will be taken to this page. 5 00:00:12,060 --> 00:00:14,910 And of course only admins will will be able to do this. 6 00:00:15,300 --> 00:00:21,390 And then you can now as an admin you can edit and submit the new information. 7 00:00:21,510 --> 00:00:27,560 For example, if you want to edit the title of the product or the description or the price or add a 8 00:00:27,570 --> 00:00:31,200 special offer or the color, you can change any of these. 9 00:00:31,560 --> 00:00:34,290 So let's work on this now in the edit product. 10 00:00:34,290 --> 00:00:38,970 Remember, we have a form and in this form we need to give it here. 11 00:00:38,970 --> 00:00:40,350 We need to give this form. 12 00:00:40,860 --> 00:00:47,520 First, let me remove this ink type and then let me say your method. 13 00:00:47,520 --> 00:00:53,130 The method is going to be post and the action is going to be the same page. 14 00:00:53,130 --> 00:00:57,530 I'm going to say edit, underscore product page. 15 00:00:58,200 --> 00:01:01,260 And then what we need to do is that we need to advocate here. 16 00:01:01,620 --> 00:01:07,440 And as I told you earlier, we already have a lot of good and we don't have to worry about the code 17 00:01:07,440 --> 00:01:10,050 because we already created so many. 18 00:01:10,050 --> 00:01:13,980 We have created we have a lot of good and we can reuse that good. 19 00:01:14,010 --> 00:01:17,100 So there is no need to type the code from scratch. 20 00:01:17,550 --> 00:01:23,970 Remember in the account we have a code that edits that updates records here in the edit password. 21 00:01:23,970 --> 00:01:26,310 In the change password we have this. 22 00:01:26,310 --> 00:01:27,030 Good. 23 00:01:27,030 --> 00:01:28,950 Let me show you where it is this good. 24 00:01:29,790 --> 00:01:37,550 So let me copy actually only these lines and then I'm going to use them in the edit product here and 25 00:01:37,570 --> 00:01:48,570 in this product first remember here we have if, if the if the the request is get we do we we we get 26 00:01:48,570 --> 00:01:49,500 all of the products. 27 00:01:49,500 --> 00:01:53,310 We we get that product, that specific product to display. 28 00:01:53,310 --> 00:01:54,660 It's all data here. 29 00:01:55,320 --> 00:02:05,850 However we need instead of saying else we can say else if it'll save and here we say else so we keep 30 00:02:05,850 --> 00:02:06,360 else. 31 00:02:06,840 --> 00:02:07,900 But we need to say else. 32 00:02:07,920 --> 00:02:09,420 If so, else if. 33 00:02:11,970 --> 00:02:14,310 Else if the request. 34 00:02:15,500 --> 00:02:27,920 If the request is is here, let me show you the edit button so that in the bottom has a name edit product. 35 00:02:27,920 --> 00:02:28,760 It is product. 36 00:02:28,760 --> 00:02:30,350 Here it is product. 37 00:02:30,350 --> 00:02:35,360 We can use this so we can edit underscore product. 38 00:02:37,790 --> 00:02:42,770 Or edit let's say it is button because this is I think better in terms of. 39 00:02:44,430 --> 00:02:50,480 It's discrete, it's meaningful in its body because by saying it is barren, you will understand that 40 00:02:50,480 --> 00:02:54,030 the user, the admin clicked on the button edit button. 41 00:02:54,030 --> 00:02:58,260 So here we to place the code which is going to do the following. 42 00:02:58,260 --> 00:02:59,520 It is going to. 43 00:03:02,560 --> 00:03:10,560 A year connected the database of update products products set. 44 00:03:10,570 --> 00:03:15,340 And then what we want to set is that we want to get we want to set the new information. 45 00:03:15,340 --> 00:03:21,640 So we need to get the the here we have the title. 46 00:03:21,640 --> 00:03:28,390 We have title description, price, category and color. 47 00:03:29,520 --> 00:03:32,210 Color and offer color and offer. 48 00:03:32,230 --> 00:03:35,430 So let me create valuables with your variables. 49 00:03:36,060 --> 00:03:45,090 I'm going to say here, first title or a title or name, let's say a title is equal to boss. 50 00:03:47,490 --> 00:03:55,380 Title then we need description is equal to. 51 00:03:58,540 --> 00:03:59,140 Lost. 52 00:04:00,280 --> 00:04:01,180 And then. 53 00:04:01,500 --> 00:04:02,080 Description. 54 00:04:02,090 --> 00:04:03,520 Description. 55 00:04:05,070 --> 00:04:06,390 And then we. 56 00:04:07,680 --> 00:04:09,000 And you say 57 00:04:11,580 --> 00:04:14,760 we can only say what else we have the price. 58 00:04:15,630 --> 00:04:20,090 So the price is going to be equal to past price. 59 00:04:20,730 --> 00:04:26,430 And then we need the offer and the colour offer is equal to cost. 60 00:04:28,930 --> 00:04:29,530 Offer. 61 00:04:31,910 --> 00:04:32,960 And then color. 62 00:04:37,460 --> 00:04:40,910 Color is equal to. 63 00:04:42,350 --> 00:04:42,860 Color. 64 00:04:43,760 --> 00:04:45,410 And after the color, we have. 65 00:04:45,410 --> 00:04:47,060 One, two, three, four, five. 66 00:04:47,630 --> 00:04:48,380 We have. 67 00:04:51,380 --> 00:04:55,640 The limit check with category, actually category. 68 00:04:56,120 --> 00:05:02,250 So the category is going to be equal to last category category. 69 00:05:03,230 --> 00:05:05,330 So here, three, three, six. 70 00:05:05,900 --> 00:05:07,730 So he let me make sure that they are six. 71 00:05:07,730 --> 00:05:09,860 So we have one, two, three. 72 00:05:11,220 --> 00:05:13,560 Four, five, six. 73 00:05:14,190 --> 00:05:14,970 So we have six. 74 00:05:15,900 --> 00:05:16,220 That's it. 75 00:05:16,230 --> 00:05:18,280 Now we have the six. 76 00:05:18,300 --> 00:05:23,480 We need to pass them into the rescue ale statement here. 77 00:05:23,490 --> 00:05:26,910 I'm going to say edit update products set. 78 00:05:27,270 --> 00:05:30,420 And then what we want to set is that we want to set the new title. 79 00:05:30,420 --> 00:05:38,160 I'm going to say that I'm going to say product underscore name is equal to is equal to question mark 80 00:05:39,180 --> 00:05:39,840 and then. 81 00:05:43,630 --> 00:05:47,800 And then comma and then product. 82 00:05:49,400 --> 00:05:51,200 Project description. 83 00:05:51,590 --> 00:05:56,090 Description is equal to question mark. 84 00:05:57,350 --> 00:06:08,090 And then we want also to edit the product product underscore price and then question mark. 85 00:06:08,090 --> 00:06:10,010 And then I'm going to add the rest in a new line. 86 00:06:10,880 --> 00:06:20,300 And then here I'm going to also say product, product offer and then is equal to question mark and then 87 00:06:20,300 --> 00:06:20,720 comma. 88 00:06:20,720 --> 00:06:27,350 And then product product underscore color is equal to question mark. 89 00:06:27,890 --> 00:06:31,430 And lastly, product category. 90 00:06:32,920 --> 00:06:34,360 Is equal to question mark. 91 00:06:35,080 --> 00:06:36,590 Where where? 92 00:06:36,610 --> 00:06:37,600 This is very important. 93 00:06:37,600 --> 00:06:44,590 Where Product Radack underscore I.D. is equal to question mark. 94 00:06:45,100 --> 00:06:48,690 Now we need to bind to we need to say statement bind. 95 00:06:48,700 --> 00:06:52,640 What we want to bind is that we want to bind the first name. 96 00:06:52,660 --> 00:06:54,190 S Description. 97 00:06:54,190 --> 00:06:54,610 S. 98 00:06:56,740 --> 00:06:57,340 Rice. 99 00:06:57,340 --> 00:06:59,200 S offer. 100 00:06:59,200 --> 00:07:08,380 I'm going to also say s color s category s and then I'd I and then I'm going to pass all of these I'm 101 00:07:08,380 --> 00:07:09,730 going to start with the product name. 102 00:07:09,730 --> 00:07:18,280 I'm going to say product, product name and then comma, product description. 103 00:07:19,150 --> 00:07:20,950 Actually, we don't have these variables. 104 00:07:20,950 --> 00:07:22,360 We have these variables. 105 00:07:22,360 --> 00:07:29,200 So I'm going to say title and then description and then price. 106 00:07:30,790 --> 00:07:40,300 And then offer and then color and then category category. 107 00:07:40,780 --> 00:07:47,500 And lastly, the product product I.D., but product I.D.. 108 00:07:48,730 --> 00:07:53,920 So now we have the product I.D. Lastly, we need to execute. 109 00:07:53,920 --> 00:07:56,530 We need to say statement and then execute. 110 00:07:57,930 --> 00:08:08,820 Execute and we can add, we can now take the user to another page so we can see Heather and then I'm 111 00:08:08,820 --> 00:08:10,410 going to see a location. 112 00:08:13,140 --> 00:08:13,920 Products. 113 00:08:15,520 --> 00:08:16,950 And then that B2B. 114 00:08:18,190 --> 00:08:20,530 And then I'm going to see myself here in the products. 115 00:08:20,950 --> 00:08:22,390 We can add a variable. 116 00:08:23,410 --> 00:08:28,450 That's going to display the, uh, the message. 117 00:08:28,450 --> 00:08:31,840 Whenever you, whenever you want to display a message, you can display it here. 118 00:08:32,710 --> 00:08:35,820 You can display it here, or you can do it. 119 00:08:35,830 --> 00:08:41,080 I'm going to give you something very smart here, and it's going to just look amazing. 120 00:08:41,590 --> 00:08:42,880 Leave me here for, say, 121 00:08:45,830 --> 00:08:46,300 a year. 122 00:08:46,300 --> 00:08:50,950 I'm going to say P and then I'm going to test I'm going to test the location of this. 123 00:08:51,550 --> 00:08:55,900 So this if I go back, this, this is going to be displayed here. 124 00:08:55,900 --> 00:08:58,390 So the if you want to display a message, you.