4
4
* @Name : phpedb.php
5
5
* @Version : 1.0
6
6
* @Programmer : Max
7
- * @Date : 2016-2019, 2019-07-10
7
+ * @Date : 2016-2019, 2019-07-10, 2020-02-26
8
8
* @Released under : https://github.com/BaseMax/PHPEDB/blob/master/LICENSE
9
9
* @Repository : https://github.com/BaseMax/PHPEDB
10
10
*
11
11
**/
12
- date_default_timezone_set ('America/Los_Angeles ' );
13
- function error_page ($ error )
14
- {
15
- $ style ="" ;
16
- // $style="
17
- // <style>
18
- // @font-face
19
- // {
20
- // font-family:'site1';
21
- // src:url('fonts/site1.woff') format('woff'),
22
- // url('fonts/site1.ttf') format('truetype');
23
- // font-weight:normal;
24
- // }
25
- // @font-face
26
- // {
27
- // font-family:'site2';
28
- // src:url('fonts/site2.woff') format('woff'),
29
- // url('fonts/site2.ttf') format('truetype');
30
- // font-weight:bold;
31
- // }
32
- // body
33
- // {
34
- // direction: rtl;
35
- // font-family:'site1';
36
- // }
37
- // </style>
38
- // ";
39
- exit ("<meta charset= \"utf-8 \"> " .$ style ."<br><br><center><h1>Error : " .$ error ."</h1></center> " );
40
- }
41
12
class database
42
13
{
43
14
public $ database =null ;
44
15
public $ db ="" ;
16
+ private function error_page ($ error )
17
+ {
18
+ exit ("<meta charset= \"utf-8 \"><br><br><center><h1>Error : " .$ error ."</h1></center> " );
19
+ }
45
20
public function connect ($ host ="localhost " ,$ user ="root " ,$ pass ="" )
46
21
{
47
22
try
@@ -53,7 +28,7 @@ public function connect($host="localhost",$user="root",$pass="")
53
28
catch (PDOException $ e )
54
29
{
55
30
$ this ->database =null ;
56
- error_page ($ e ->getMessage ());
31
+ $ this -> error_page ($ e ->getMessage ());
57
32
}
58
33
}
59
34
public function check ()
@@ -78,7 +53,7 @@ public function selectRaw($query)
78
53
}
79
54
catch (PDOException $ e )
80
55
{
81
- error_page ($ e ->getMessage ());
56
+ $ this -> error_page ($ e ->getMessage ());
82
57
}
83
58
}
84
59
public function selectsRaw ($ query )
@@ -91,7 +66,7 @@ public function selectsRaw($query)
91
66
}
92
67
catch (PDOException $ e )
93
68
{
94
- error_page ($ e ->getMessage ());
69
+ $ this -> error_page ($ e ->getMessage ());
95
70
}
96
71
}
97
72
public function query ($ query ,$ error =true )
@@ -104,7 +79,7 @@ public function query($query,$error=true)
104
79
{
105
80
if ($ error == true )
106
81
{
107
- error_page ($ e ->getMessage ());
82
+ $ this -> error_page ($ e ->getMessage ());
108
83
}
109
84
}
110
85
}
@@ -118,7 +93,7 @@ public function create_database($name,$error=true)
118
93
{
119
94
if ($ error == true )
120
95
{
121
- error_page ($ e ->getMessage ());
96
+ $ this -> error_page ($ e ->getMessage ());
122
97
}
123
98
}
124
99
}
@@ -177,7 +152,7 @@ public function selects($table,$clause=[],$after="",$__sql="")
177
152
}
178
153
catch (PDOException $ e )
179
154
{
180
- error_page ($ e ->getMessage ());
155
+ $ this -> error_page ($ e ->getMessage ());
181
156
}
182
157
}
183
158
public function select ($ table ,$ clause =[],$ after ="" )
@@ -229,7 +204,7 @@ public function select($table,$clause=[],$after="")
229
204
}
230
205
catch (PDOException $ e )
231
206
{
232
- error_page ($ e ->getMessage ());
207
+ $ this -> error_page ($ e ->getMessage ());
233
208
}
234
209
}
235
210
public function count ($ table ,$ clause =[])
@@ -280,7 +255,7 @@ public function count($table,$clause=[])
280
255
}
281
256
catch (PDOException $ e )
282
257
{
283
- error_page ($ e ->getMessage ());
258
+ $ this -> error_page ($ e ->getMessage ());
284
259
}
285
260
}
286
261
public function delete ($ table ,$ clause =[])
@@ -330,7 +305,7 @@ public function delete($table,$clause=[])
330
305
}
331
306
catch (PDOException $ e )
332
307
{
333
- error_page ($ e ->getMessage ());
308
+ $ this -> error_page ($ e ->getMessage ());
334
309
}
335
310
}
336
311
public function insert ($ table ,$ values )
@@ -369,7 +344,7 @@ public function insert($table,$values)
369
344
}
370
345
catch (PDOException $ e )
371
346
{
372
- error_page ($ e ->getMessage ());
347
+ $ this -> error_page ($ e ->getMessage ());
373
348
}
374
349
}
375
350
public function update ($ table ,$ clause ,$ values )
@@ -439,16 +414,7 @@ public function update($table,$clause,$values)
439
414
}
440
415
catch (PDOException $ e )
441
416
{
442
- error_page ($ e ->getMessage ());
417
+ $ this -> error_page ($ e ->getMessage ());
443
418
}
444
419
}
445
420
}
446
- // function convert($string)
447
- // {
448
- // $persian = ['۰', '۱', '۲', '۳', '۴', '۵', '۶', '۷', '۸', '۹'];
449
- // $arabic = ['٩', '٨', '٧', '٦', '٥', '٤', '٣', '٢', '١','٠'];
450
- // $num = range(0, 9);
451
- // $convertedPersianNums = str_replace($persian, $num,$string);
452
- // $englishNumbersOnly = str_replace($arabic, $num, $convertedPersianNums);
453
- // return $englishNumbersOnly;
454
- // }
0 commit comments