0
1
00:00:04,041 --> 00:00:04,880
<v Instructor>Hello again.</v>
1

2
00:00:04,880 --> 00:00:05,742
In previous lecture what we did,
2

3
00:00:05,742 --> 00:00:10,053
we create our design for 'Add People' page,
3

4
00:00:10,053 --> 00:00:12,430
and now I want to show you something.
4

5
00:00:12,430 --> 00:00:16,043
Actually, every time we are going to main,
5

6
00:00:17,070 --> 00:00:18,512
we are running AddPeople, right?
6

7
00:00:18,512 --> 00:00:21,190
So we can solve this problem.
7

8
00:00:21,190 --> 00:00:25,392
If you want to run your AddPeople page python file,
8

9
00:00:25,392 --> 00:00:27,000
If you want to run your AddPeople page python file,
9

10
00:00:27,000 --> 00:00:28,640
you can copy this 'def main'
10

11
00:00:28,640 --> 00:00:29,780
and until here,
11

12
00:00:29,780 --> 00:00:33,596
if name equals equals main load main function.
12

13
00:00:33,596 --> 00:00:35,511
if name equals equals main load main function.
13

14
00:00:35,511 --> 00:00:37,610
We can copy and paste it here
14

15
00:00:38,570 --> 00:00:40,250
and it will be easy.
15

16
00:00:40,250 --> 00:00:43,655
But after we are done with this,
16

17
00:00:43,655 --> 00:00:45,193
we need to remove this.
17

18
00:00:47,100 --> 00:00:49,240
We need to remove these codes, okay?
18

19
00:00:49,240 --> 00:00:51,610
So here what I need to change,
19

20
00:00:51,610 --> 00:00:52,710
I need to change here.
20

21
00:00:54,691 --> 00:00:57,400
I need to remove root, okay?
21

22
00:00:57,400 --> 00:01:02,310
And even we don't need these guys, okay?
22

23
00:01:02,310 --> 00:01:04,250
We can keep them is not a problem.
23

24
00:01:04,250 --> 00:01:08,610
For the application app, will be AddPeople
24

25
00:01:08,610 --> 00:01:10,713
because our class name is AddPeople.
25

26
00:01:11,840 --> 00:01:14,157
So here I will say, AddPeople
26

27
00:01:15,532 --> 00:01:18,700
and now we can run our file individually.
27

28
00:01:18,700 --> 00:01:20,420
You see?
28

29
00:01:20,420 --> 00:01:21,897
But we will have another file.
29

30
00:01:21,897 --> 00:01:22,810
Why is it like that?
30

31
00:01:22,810 --> 00:01:25,909
Because we are creating here two main.
31

32
00:01:25,909 --> 00:01:28,640
First one is that one, other one is that one.
32

33
00:01:28,640 --> 00:01:30,310
That's why is like that.
33

34
00:01:30,310 --> 00:01:32,332
And also here, you see we have here,
34

35
00:01:32,332 --> 00:01:36,453
a grey area, so how can we solve this problem?
35

36
00:01:38,230 --> 00:01:41,638
Because this text editor causes  that area, 
36

37
00:01:41,638 --> 00:01:42,699
so it's height..
37

38
00:01:42,699 --> 00:01:45,197
So we can solve this problem
38

39
00:01:45,197 --> 00:01:48,394
by increasing here our label and height.
39

40
00:01:48,394 --> 00:01:51,607
by increasing here our label and height.
40

41
00:01:51,607 --> 00:01:54,200
by increasing here our label and height.
41

42
00:01:54,200 --> 00:01:57,710
If I say 600, I think it will be fine.
42

43
00:01:57,710 --> 00:01:59,220
Let's run it.
43

44
00:01:59,220 --> 00:02:00,270
As you see now, it's okay.
44

45
00:02:00,270 --> 00:02:01,490
It's here.
45

46
00:02:01,490 --> 00:02:02,823
So, what is next?
46

47
00:02:02,823 --> 00:02:05,305
What I want to do, then I hit this button
47

48
00:02:05,305 --> 00:02:08,710
and then I fill all the areas of course.
48

49
00:02:08,710 --> 00:02:10,299
And after I click this button,
49

50
00:02:10,299 --> 00:02:14,600
I want to insert into the database my values, right?
50

51
00:02:14,600 --> 00:02:16,900
I want to insert into the database my values, right?
51

52
00:02:16,900 --> 00:02:18,740
To do that what can I do?
52

53
00:02:18,740 --> 00:02:21,200
I need to come here to find my button.
53

54
00:02:21,200 --> 00:02:22,713
My button is here.
54

55
00:02:24,320 --> 00:02:27,861
I will say here button command is equal to,
55

56
00:02:27,861 --> 00:02:30,088
I will say here button command is equal to,
56

57
00:02:30,088 --> 00:02:32,644
let's say here, self.addPerson.
57

58
00:02:32,644 --> 00:02:35,530
let's say here, self.addPerson.
58

59
00:02:35,530 --> 00:02:37,660
This is our definition name.
59

60
00:02:37,660 --> 00:02:42,506
And here, I will say addPerson and here what I need to do.
60

61
00:02:42,506 --> 00:02:47,506
And here, I will say addPerson and here what I need to do.
61

62
00:02:47,647 --> 00:02:50,940
Firstly I need to get values from these entries.
62

63
00:02:50,940 --> 00:02:52,803
And also text editor, right?
63

64
00:02:53,800 --> 00:02:55,100
How can I get the name?
64

65
00:02:55,100 --> 00:02:58,441
Name is equal to, I will say, self.ent_name.get method.
65

66
00:02:58,441 --> 00:03:03,441
Name is equal to, I will say, self.ent_name.get method.
66

67
00:03:03,700 --> 00:03:07,110
If you want, you can print it out.
67

68
00:03:07,110 --> 00:03:08,363
Let's say name.
68

69
00:03:09,620 --> 00:03:11,723
If I run my application again.
69

70
00:03:13,920 --> 00:03:17,260
So here, even if we can't solve this problem,
70

71
00:03:17,260 --> 00:03:19,640
because this one is front, right?
71

72
00:03:19,640 --> 00:03:22,844
So it comes back this one.
72

73
00:03:22,844 --> 00:03:26,736
To do that, we can say here, self.lift and here.
73

74
00:03:26,736 --> 00:03:30,418
To do that, we can say here, self.lift and here.
74

75
00:03:30,418 --> 00:03:34,250
To do that, we can say here, self.lift and here.
75

76
00:03:34,250 --> 00:03:36,093
If I run it again.
76

77
00:03:37,480 --> 00:03:39,120
No, it's okay.
77

78
00:03:39,120 --> 00:03:40,263
Anyway it's okay.
78

79
00:03:41,353 --> 00:03:44,003
It is main because that's why it is doing that.
79

80
00:03:45,760 --> 00:03:47,063
So what I need to do?
80

81
00:03:51,010 --> 00:03:54,238
For example, now we have some text inside.
81

82
00:03:54,238 --> 00:03:57,430
For example, now we have some text inside.
82

83
00:03:57,430 --> 00:03:58,840
If I say something like that,
83

84
00:03:58,840 --> 00:04:00,893
if I click the button AddPerson,
84

85
00:04:01,760 --> 00:04:05,550
as you see, my value is here 'aaaa'.
85

86
00:04:05,550 --> 00:04:06,383
So, fine.
86

87
00:04:06,383 --> 00:04:07,400
What I need to do?
87

88
00:04:07,400 --> 00:04:08,423
Let's go on here.
88

89
00:04:11,346 --> 00:04:15,780
After that let's click CTRL+D, CTRL+D.
89

90
00:04:15,780 --> 00:04:17,740
And four CTRL+D.
90

91
00:04:17,740 --> 00:04:19,260
And again CTRL+D.
91

92
00:04:19,260 --> 00:04:20,633
Five times.
92

93
00:04:22,800 --> 00:04:25,462
But for this one I will use something else.
93

94
00:04:25,462 --> 00:04:27,394
For name, surname, okay?
94

95
00:04:27,394 --> 00:04:28,910
For name, surname, okay?
95

96
00:04:28,910 --> 00:04:30,993
And entry surname.
96

97
00:04:32,800 --> 00:04:36,250
And after that here will be email,
97

98
00:04:36,250 --> 00:04:38,853
and that one will also be email,
98

99
00:04:41,290 --> 00:04:45,423
and the other one, this one, is phone,
99

100
00:04:46,690 --> 00:04:48,223
and this one is again phone.
100

101
00:04:50,560 --> 00:04:53,140
But for text editor what we need to do?
101

102
00:04:53,140 --> 00:04:54,330
We need to use another function.
102

103
00:04:54,330 --> 00:04:56,681
So, I will say address is equal to self.get
103

104
00:04:56,681 --> 00:05:00,380
So, I will say address is equal to self.get
104

105
00:05:03,281 --> 00:05:04,679
Self.address.get.
105

106
00:05:04,679 --> 00:05:05,987
Self.address.get.
106

107
00:05:05,987 --> 00:05:07,573
Self.address.get.
107

108
00:05:07,573 --> 00:05:09,817
and here I will say from first character 1.0
108

109
00:05:11,197 --> 00:05:12,210
and here I will say from first character 1.0
109

110
00:05:12,210 --> 00:05:14,763
until comma end.
110

111
00:05:15,760 --> 00:05:16,593
Okay?
111

112
00:05:17,545 --> 00:05:19,393
But end here, 'end-1c'.
112

113
00:05:19,393 --> 00:05:21,353
But end here, 'end-1c'.
113

114
00:05:21,353 --> 00:05:24,073
Now, we got all values from our fields.
114

115
00:05:24,073 --> 00:05:27,240
Now, we got all values from our fields.
115

116
00:05:27,240 --> 00:05:29,070
By the way I want to tell you something.
116

117
00:05:29,070 --> 00:05:31,253
I think you know that,
117

118
00:05:31,253 --> 00:05:34,074
but still I want to talk about it.
118

119
00:05:34,074 --> 00:05:36,560
but still I want to talk about it.
119

120
00:05:36,560 --> 00:05:41,050
Now if I don't use self here for example for 'address',
120

121
00:05:41,050 --> 00:05:43,620
we cannot use this widget here,
121

122
00:05:43,620 --> 00:05:45,250
we cannot use this widget here,
122

123
00:05:45,250 --> 00:05:46,700
in another function.
123

124
00:05:46,700 --> 00:05:47,533
This is very important.
124

125
00:05:47,533 --> 00:05:50,912
If you want to use a widget in another function,
125

126
00:05:50,912 --> 00:05:53,143
you need to use self parameter.
126

127
00:05:54,110 --> 00:05:55,360
This is important.
127

128
00:05:55,360 --> 00:05:57,950
And here after that what I need to do?
128

129
00:05:57,950 --> 00:05:59,553
Here I will say if.
129

130
00:06:01,570 --> 00:06:04,430
And we already created our cursor right?
130

131
00:06:04,430 --> 00:06:05,263
It's here.
131

132
00:06:05,263 --> 00:06:06,810
Connection and cursor.
132

133
00:06:06,810 --> 00:06:07,760
It's okay, it's fine.
133

134
00:06:07,760 --> 00:06:08,700
It's here.
134

135
00:06:08,700 --> 00:06:13,249
So here I will say if 'name' and 'surname' and 'email'
135

136
00:06:13,249 --> 00:06:17,671
So here I will say if 'name' and 'surname' and 'email'
136

137
00:06:17,671 --> 00:06:20,940
So here I will say if 'name' and 'surname' and 'email'
137

138
00:06:20,940 --> 00:06:22,253
and 'phone' and 'address', okay?
138

139
00:06:23,157 --> 00:06:25,100
and 'phone' and 'address', okay?
139

140
00:06:25,100 --> 00:06:28,370
and 'phone' and 'address', okay?
140

141
00:06:28,370 --> 00:06:29,747
Not equals empty.
141

142
00:06:29,747 --> 00:06:31,157
Not equals empty.
142

143
00:06:31,157 --> 00:06:32,210
Not equals empty.
143

144
00:06:32,210 --> 00:06:33,820
If not equals empty,
144

145
00:06:33,820 --> 00:06:36,950
after that I will insert into my database.
145

146
00:06:36,950 --> 00:06:38,584
Here I will say pass firstly.
146

147
00:06:38,584 --> 00:06:43,584
For 'else' here let's create 'else' statement first.
147

148
00:06:43,675 --> 00:06:46,743
And here if not, I will say messagebox.
148

149
00:06:46,743 --> 00:06:48,502
For messagebox what I need to do?
149

150
00:06:48,502 --> 00:06:51,038
I need to import messagebox, right?
150

151
00:06:51,038 --> 00:06:53,788
So, I will say here from tkinter.
151

152
00:06:55,458 --> 00:06:58,325
From tkinter import messagebox, okay.
152

153
00:06:58,325 --> 00:07:02,098
From tkinter import messagebox, okay.
153

154
00:07:02,098 --> 00:07:03,675
So, after that here what I need to do?
154

155
00:07:03,675 --> 00:07:07,508
I need to come here for 'else' and I will say,
155

156
00:07:10,235 --> 00:07:12,085
'else messagebox.showerror'
156

157
00:07:12,085 --> 00:07:14,153
'else messagebox.showerror'
157

158
00:07:15,792 --> 00:07:18,727
and first parameter is my title 'Error'
158

159
00:07:20,230 --> 00:07:23,610
and second one is my message
159

160
00:07:23,610 --> 00:07:26,756
and I will say 'Can't add to database'.
160

161
00:07:26,756 --> 00:07:29,207
and I will say 'Can't add to database'.
161

162
00:07:29,207 --> 00:07:31,571
And the third one is optional,
162

163
00:07:31,571 --> 00:07:33,050
And the third one is optional,
163

164
00:07:33,050 --> 00:07:37,384
but I will create another icon and I will say warning icon.
164

165
00:07:37,384 --> 00:07:39,820
but I will create another icon and I will say warning icon.
165

166
00:07:39,820 --> 00:07:41,580
This is optional parameter, by the way.
166

167
00:07:41,580 --> 00:07:42,540
Icon.
167

168
00:07:42,540 --> 00:07:44,250
And this is okay, if not,
168

169
00:07:44,250 --> 00:07:49,250
for 'else' we are showing a messagebox to users, right?
169

170
00:07:49,480 --> 00:07:51,875
For if what I will say, here?
170

171
00:07:51,875 --> 00:07:54,949
By the way, why am I using 'name' and 'surname' and 'email'
171

172
00:07:54,949 --> 00:07:57,370
and 'phone' and 'address' not equals empty?
172

173
00:07:57,370 --> 00:08:01,172
That means all areas users have to fill all areas, okay?
173

174
00:08:01,172 --> 00:08:04,992
That means all areas users have to fill all areas, okay?
174

175
00:08:04,992 --> 00:08:06,725
No one can be empty.
175

176
00:08:06,725 --> 00:08:07,558
It is important.
176

177
00:08:07,558 --> 00:08:11,744
And here, for 'if' I will use 'try' and 'except', okay?
177

178
00:08:11,744 --> 00:08:14,980
And here, for 'if' I will use 'try' and 'except', okay?
178

179
00:08:14,980 --> 00:08:17,080
Because I want to...
179

180
00:08:17,080 --> 00:08:20,430
If any problem, I want to catch it, okay?
180

181
00:08:20,430 --> 00:08:23,100
Except let's say 'pass' for now.
181

182
00:08:23,100 --> 00:08:26,290
Also, use something for 'except'.
182

183
00:08:26,290 --> 00:08:30,801
And here I will say my query is equal to 'Insert into'.
183

184
00:08:30,801 --> 00:08:35,350
And here I will say my query is equal to 'Insert into'.
184

185
00:08:35,350 --> 00:08:37,683
My title name was, remember,
185

186
00:08:38,761 --> 00:08:40,178
it was 'persons'.
186

187
00:08:41,470 --> 00:08:42,785
This is important.
187

188
00:08:42,785 --> 00:08:44,179
My table name is important.
188

189
00:08:44,179 --> 00:08:45,740
It is 'persons'.
189

190
00:08:45,740 --> 00:08:48,233
And after that here what I need to do?
190

191
00:08:49,610 --> 00:08:53,310
Here say my table fields, okay?
191

192
00:08:53,310 --> 00:08:55,460
And the first one was,
192

193
00:08:55,460 --> 00:09:00,310
and firstly here I will say parentheses and 'person_name'
193

194
00:09:02,940 --> 00:09:05,837
and second one was 'person_surname'
194

195
00:09:10,343 --> 00:09:13,849
and after that 'person_email', 'person_phone',
195

196
00:09:13,849 --> 00:09:17,682
and after that 'person_email', 'person_phone',
196

197
00:09:20,620 --> 00:09:24,580
and last one is 'person_address', right?
197

198
00:09:24,580 --> 00:09:28,970
And 'person_address', okay!
198

199
00:09:28,970 --> 00:09:31,460
So after that what I need to do?
199

200
00:09:31,460 --> 00:09:34,548
I need to say here 'address', right?
200

201
00:09:34,548 --> 00:09:36,480
I need to say here 'address', right?
201

202
00:09:36,480 --> 00:09:39,910
And after 'address', here I will say.
202

203
00:09:39,910 --> 00:09:42,150
Let me come here and here.
203

204
00:09:42,150 --> 00:09:44,317
Let me come here and here.
204

205
00:09:46,790 --> 00:09:48,483
I need to say 'values'.
205

206
00:09:50,750 --> 00:09:52,036
Okay?
206

207
00:09:52,036 --> 00:09:52,869
For the 'values' I will say,
207

208
00:09:52,869 --> 00:09:54,207
the first one is '?'.
208

209
00:09:55,890 --> 00:09:58,714
And I have five different values, right?
209

210
00:09:58,714 --> 00:10:01,789
'?' and ',' again '?' and ',' and again '?'.
210

211
00:10:01,789 --> 00:10:06,789
'?' and ',' again '?' and ',' and again '?'.
211

212
00:10:08,670 --> 00:10:09,689
Okay!
212

213
00:10:09,689 --> 00:10:10,522
(loud coughing)
213

214
00:10:10,522 --> 00:10:11,355
Sorry.
214

215
00:10:11,355 --> 00:10:13,643
So we are done, okay?
215

216
00:10:14,900 --> 00:10:16,140
So what we need to do?
216

217
00:10:16,140 --> 00:10:17,580
Let me check something wrong.
217

218
00:10:17,580 --> 00:10:18,730
Actually it's not wrong
218

219
00:10:18,730 --> 00:10:21,260
because of why we are getting this problem,
219

220
00:10:21,260 --> 00:10:24,650
and except pass it's okay.
220

221
00:10:24,650 --> 00:10:26,183
So I need to come here.
221

222
00:10:28,420 --> 00:10:29,728
Okay.
222

223
00:10:29,728 --> 00:10:32,280
Query is like that 'insert into persons',
223

224
00:10:32,280 --> 00:10:34,757
'person_name', 'person_surname', 'person_email',
224

225
00:10:36,001 --> 00:10:37,920
'person_phone', 'person_address', 'values'.
225

226
00:10:41,260 --> 00:10:43,250
So this is the problem, you see here.
226

227
00:10:43,250 --> 00:10:46,433
This quote must be here, okay?
227

228
00:10:47,450 --> 00:10:49,560
This is fine now, okay!
228

229
00:10:49,560 --> 00:10:51,233
So what we need to do now?
229

230
00:10:52,810 --> 00:10:55,157
Our query is ready, right?
230

231
00:10:55,157 --> 00:10:57,311
Here I will say my cursor.
231

232
00:10:57,311 --> 00:10:59,419
Here I will say my cursor.
232

233
00:10:59,419 --> 00:11:00,580
Here I will say my cursor.
233

234
00:11:00,580 --> 00:11:03,770
Cursor.execute, okay?
234

235
00:11:03,770 --> 00:11:08,770
And my query, and after it, here, I will say my parameters.
235

236
00:11:09,380 --> 00:11:13,278
My parameters' name, surname, email, phone and address.
236

237
00:11:13,278 --> 00:11:14,228
So I will say name.
237

238
00:11:16,200 --> 00:11:17,033
Name.
238

239
00:11:19,860 --> 00:11:23,010
Surname, email, phone and address, okay?
239

240
00:11:23,010 --> 00:11:25,864
Surname, email, phone and address, okay?
240

241
00:11:25,864 --> 00:11:29,197
Surname, email, phone and address, okay?
241

242
00:11:30,600 --> 00:11:33,120
And after that, what I need to say?
242

243
00:11:33,120 --> 00:11:35,313
I need to use here 'commit'.
243

244
00:11:36,222 --> 00:11:37,055
Con.commit.
244

245
00:11:37,055 --> 00:11:40,610
I want to tell you something about commit function.
245

246
00:11:40,610 --> 00:11:43,000
If you update your database,
246

247
00:11:43,000 --> 00:11:45,850
if you insert into something your database,
247

248
00:11:45,850 --> 00:11:48,480
or if you update your database,
248

249
00:11:48,480 --> 00:11:51,660
or you delete something from your database,
249

250
00:11:51,660 --> 00:11:54,160
you need to use this commit function.
250

251
00:11:54,160 --> 00:11:56,260
But if you select something from database,
251

252
00:11:58,590 --> 00:12:01,050
you don't need to use commit function.
252

253
00:12:01,050 --> 00:12:02,100
Commit function is like
253

254
00:12:02,100 --> 00:12:05,760
if you change something in your database.
254

255
00:12:05,760 --> 00:12:07,790
If you change the value,
255

256
00:12:07,790 --> 00:12:10,790
if you change your database values, okay?
256

257
00:12:10,790 --> 00:12:13,980
If you add something new or update or delete,
257

258
00:12:13,980 --> 00:12:15,000
you need to use commit, okay?
258

259
00:12:15,000 --> 00:12:15,963
Don't forget that.
259

260
00:12:16,992 --> 00:12:19,820
And after here, I will say use messagebox.showinfo,
260

261
00:12:21,757 --> 00:12:24,828
and for showinfo I will say 'Success'.
261

262
00:12:24,828 --> 00:12:27,995
and for showinfo I will say 'Success'.
262

263
00:12:30,821 --> 00:12:32,343
And this is my title.
263

264
00:12:32,343 --> 00:12:35,655
And my message 'Successfully added to database', okay?
264

265
00:12:35,655 --> 00:12:39,848
And my message 'Successfully added to database', okay?
265

266
00:12:39,848 --> 00:12:44,660
And my message 'Successfully added to database', okay?
266

267
00:12:44,660 --> 00:12:46,572
And here we can use icon.
267

268
00:12:46,572 --> 00:12:48,663
And here we can use icon.
268

269
00:12:50,040 --> 00:12:53,610
And for icon I will use info, okay?
269

270
00:12:53,610 --> 00:12:55,570
Icon name is info.
270

271
00:12:55,570 --> 00:12:58,971
And after that what I need to do is find for 'except' also,
271

272
00:12:58,971 --> 00:13:01,150
what I need to say.
272

273
00:13:01,150 --> 00:13:02,500
If we are not...
273

274
00:13:03,370 --> 00:13:06,760
This except is for this 'try', okay?
274

275
00:13:06,760 --> 00:13:08,020
not for this 'if'
275

276
00:13:08,020 --> 00:13:10,280
and again I need to show here a message,
276

277
00:13:10,280 --> 00:13:12,980
so I will say message error.
277

278
00:13:12,980 --> 00:13:15,713
I will copy this guy and paste it here.
278

279
00:13:17,200 --> 00:13:18,693
And here, now,
279

280
00:13:22,260 --> 00:13:24,760
here we say 'Can't add to database',
280

281
00:13:24,760 --> 00:13:26,450
but here what we need to say?
281

282
00:13:26,450 --> 00:13:30,257
We need to say here 'Fields cannot be empty', okay?
282

283
00:13:30,257 --> 00:13:35,224
We need to say here 'Fields cannot be empty', okay?
283

284
00:13:35,224 --> 00:13:36,510
Be empty.
284

285
00:13:36,510 --> 00:13:40,577
This message for 'if' fields are empty, okay?
285

286
00:13:40,577 --> 00:13:44,327
This message for 'if' fields are empty, okay?
286

287
00:13:45,902 --> 00:13:46,810
Okay.
287

288
00:13:46,810 --> 00:13:49,710
So that one is if you cannot add to database.
288

289
00:13:49,710 --> 00:13:51,580
Something wrong about our database
289

290
00:13:51,580 --> 00:13:53,900
or system or computer, anything, okay?
290

291
00:13:53,900 --> 00:13:56,690
But this is about our fields, okay?
291

292
00:13:56,690 --> 00:13:58,130
So what I need to do now?
292

293
00:13:58,130 --> 00:13:59,683
Let's run from main.
293

294
00:14:00,549 --> 00:14:01,760
And main,
294

295
00:14:01,760 --> 00:14:02,853
And run.
295

296
00:14:04,220 --> 00:14:09,220
My people. Add, and now, here let's say,
296

297
00:14:10,910 --> 00:14:12,630
David, okay?
297

298
00:14:12,630 --> 00:14:15,150
And Blue, email david@gmail.com,
298

299
00:14:15,150 --> 00:14:19,610
And Blue, email david@gmail.com,
299

300
00:14:19,610 --> 00:14:24,490
phone number +1 something like that for the phone.
300

301
00:14:24,490 --> 00:14:25,523
Let's say.
301

302
00:14:28,827 --> 00:14:30,351
LAX.
302

303
00:14:30,351 --> 00:14:32,700
LA so Los Angeles.
303

304
00:14:36,660 --> 00:14:40,094
And here, let's say United States of America.
304

305
00:14:40,094 --> 00:14:41,169
Okay.
305

306
00:14:41,169 --> 00:14:44,040
So if I say 'Add Person', let's check it.
306

307
00:14:44,040 --> 00:14:45,680
Something wrong.
307

308
00:14:45,680 --> 00:14:47,330
Name address is not defined.
308

309
00:14:47,330 --> 00:14:48,423
It's said here.
309

310
00:14:49,696 --> 00:14:52,650
So, address is...
310

311
00:14:52,650 --> 00:14:55,730
So must be here.
311

312
00:14:55,730 --> 00:14:58,830
Address must be double 's', right.
312

313
00:14:58,830 --> 00:15:00,260
So that is fine.
313

314
00:15:00,260 --> 00:15:01,790
So name, email.
314

315
00:15:01,790 --> 00:15:05,890
So name, surname, email, phone, address, okay!
315

316
00:15:05,890 --> 00:15:09,280
Again we need to go back here.
316

317
00:15:09,280 --> 00:15:10,853
My People, add.
317

318
00:15:13,412 --> 00:15:15,067
So here I will say name 'David', 'Blue',
318

319
00:15:17,426 --> 00:15:19,426
email 'david@gmail.com',
319

320
00:15:22,280 --> 00:15:25,330
phone number +1 something like that,
320

321
00:15:25,330 --> 00:15:29,843
and for address this time say 'London UK'.
321

322
00:15:32,630 --> 00:15:34,550
After that, 'Add Person'.
322

323
00:15:34,550 --> 00:15:35,480
You see?
323

324
00:15:35,480 --> 00:15:37,093
'Can't update database'
324

325
00:15:38,344 --> 00:15:39,517
Something wrong about our code, okay?
325

326
00:15:39,517 --> 00:15:40,350
SQL code.
326

327
00:15:41,243 --> 00:15:45,780
Because this comes from our 'except', right?
327

328
00:15:45,780 --> 00:15:48,993
And here let's go back here.
328

329
00:15:51,342 --> 00:15:53,242
By the way now we can remove this guy.
329

330
00:15:54,180 --> 00:15:55,023
Not this one.
330

331
00:15:58,630 --> 00:16:02,979
So, here insert into persons, person_name, person_surname,
331

332
00:16:02,979 --> 00:16:06,203
So, here insert into persons, person_name, person_surname,
332

333
00:16:07,445 --> 00:16:10,370
person_email, person_phone, person_address.
333

334
00:16:10,370 --> 00:16:13,643
Values one, two, three, four, five.
334

335
00:16:15,910 --> 00:16:18,220
Also looks fine.
335

336
00:16:18,220 --> 00:16:22,450
Person, person and here, what can be wrong?
336

337
00:16:22,450 --> 00:16:23,573
Because here,
337

338
00:16:25,120 --> 00:16:28,003
here we didn't close our parentheses, okay?
338

339
00:16:30,530 --> 00:16:33,860
It start open parenthesis, closed parenthesis here.
339

340
00:16:33,860 --> 00:16:35,350
So, values, open parenthesis,
340

341
00:16:35,350 --> 00:16:37,480
closed parenthesis and after that quote.
341

342
00:16:37,480 --> 00:16:39,450
So this is important guys.
342

343
00:16:39,450 --> 00:16:41,930
You need to be careful, okay?
343

344
00:16:41,930 --> 00:16:46,110
Be careful to write your queries for database, okay?
344

345
00:16:46,110 --> 00:16:48,414
So be careful about it.
345

346
00:16:48,414 --> 00:16:49,818
It is very important.
346

347
00:16:49,818 --> 00:16:50,651
And now let's go back to main.
347

348
00:16:50,651 --> 00:16:52,163
I hope this time is fine.
348

349
00:16:53,676 --> 00:16:55,810
And 'My People', 'Add',
349

350
00:16:55,810 --> 00:16:58,733
again let's say David,
350

351
00:16:59,600 --> 00:17:04,600
and the surname is Blue, and email david@gmail.com, +1234.
351

352
00:17:13,180 --> 00:17:16,190
You might wonder when we create our database field
352

353
00:17:16,190 --> 00:17:20,591
for phone, remember we set it as a text.
353

354
00:17:20,591 --> 00:17:21,424
Why is it like that?
354

355
00:17:21,424 --> 00:17:23,160
Because you see we are here,
355

356
00:17:23,160 --> 00:17:25,660
we are using plus symbol.
356

357
00:17:25,660 --> 00:17:27,513
And this is the first reason, okay?
357

358
00:17:29,543 --> 00:17:30,638
And other reason is also
358

359
00:17:30,638 --> 00:17:33,060
from entries we can get text values, okay?
359

360
00:17:33,060 --> 00:17:34,423
String values, sorry.
360

361
00:17:39,777 --> 00:17:42,277
So if you create integer value
361

362
00:17:46,630 --> 00:17:51,060
for your phone table, phone field in database,
362

363
00:17:51,060 --> 00:17:52,800
you need to convert this value.
363

364
00:17:52,800 --> 00:17:54,203
This is, you know, long way.
364

365
00:17:55,118 --> 00:17:59,060
That is why I created my text fields in database.
365

366
00:17:59,060 --> 00:18:04,060
Sorry for the phone field, I set it as text, okay?
366

367
00:18:04,537 --> 00:18:07,010
Not integer.
367

368
00:18:07,010 --> 00:18:12,010
This is the information about our database field,
368

369
00:18:12,990 --> 00:18:17,990
and here I will say again London UK.
369

370
00:18:19,460 --> 00:18:21,340
And after, 'Add Person'.
370

371
00:18:21,340 --> 00:18:23,480
'Succesfully added to database'.
371

372
00:18:23,480 --> 00:18:24,994
Great!
372

373
00:18:24,994 --> 00:18:25,827
It is working now.
373

374
00:18:25,827 --> 00:18:29,543
I will close this one and I will go to here database.
374

375
00:18:30,550 --> 00:18:32,143
Show in Explorer.
375

376
00:18:34,120 --> 00:18:35,683
And here I will click it.
376

377
00:18:37,840 --> 00:18:39,780
And browse data.
377

378
00:18:39,780 --> 00:18:43,550
As you see now here, person id is one
378

379
00:18:43,550 --> 00:18:47,630
and David Blue david@gmail.com and here phone number
379

380
00:18:47,630 --> 00:18:48,573
and London UK.
380

381
00:18:49,900 --> 00:18:50,733
Great!
381

382
00:18:50,733 --> 00:18:51,870
So everything works very well!
382

383
00:18:51,870 --> 00:18:53,123
See you in the next!
