44 * @Name : phpedb.php
55 * @Version : 1.0
66 * @Programmer : Max
7- * @Date : 2016-2019, 2019-07-10
7+ * @Date : 2016-2019, 2019-07-10, 2020-02-26
88 * @Released under : https://github.com/BaseMax/PHPEDB/blob/master/LICENSE
99 * @Repository : https://github.com/BaseMax/PHPEDB
1010 *
1111 **/
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- }
4112class database
4213{
4314 public $ database =null ;
4415 public $ db ="" ;
16+ private function error_page ($ error )
17+ {
18+ exit ("<meta charset= \"utf-8 \"><br><br><center><h1>Error : " .$ error ."</h1></center> " );
19+ }
4520 public function connect ($ host ="localhost " ,$ user ="root " ,$ pass ="" )
4621 {
4722 try
@@ -53,7 +28,7 @@ public function connect($host="localhost",$user="root",$pass="")
5328 catch (PDOException $ e )
5429 {
5530 $ this ->database =null ;
56- error_page ($ e ->getMessage ());
31+ $ this -> error_page ($ e ->getMessage ());
5732 }
5833 }
5934 public function check ()
@@ -78,7 +53,7 @@ public function selectRaw($query)
7853 }
7954 catch (PDOException $ e )
8055 {
81- error_page ($ e ->getMessage ());
56+ $ this -> error_page ($ e ->getMessage ());
8257 }
8358 }
8459 public function selectsRaw ($ query )
@@ -91,7 +66,7 @@ public function selectsRaw($query)
9166 }
9267 catch (PDOException $ e )
9368 {
94- error_page ($ e ->getMessage ());
69+ $ this -> error_page ($ e ->getMessage ());
9570 }
9671 }
9772 public function query ($ query ,$ error =true )
@@ -104,7 +79,7 @@ public function query($query,$error=true)
10479 {
10580 if ($ error == true )
10681 {
107- error_page ($ e ->getMessage ());
82+ $ this -> error_page ($ e ->getMessage ());
10883 }
10984 }
11085 }
@@ -118,7 +93,7 @@ public function create_database($name,$error=true)
11893 {
11994 if ($ error == true )
12095 {
121- error_page ($ e ->getMessage ());
96+ $ this -> error_page ($ e ->getMessage ());
12297 }
12398 }
12499 }
@@ -177,7 +152,7 @@ public function selects($table,$clause=[],$after="",$__sql="")
177152 }
178153 catch (PDOException $ e )
179154 {
180- error_page ($ e ->getMessage ());
155+ $ this -> error_page ($ e ->getMessage ());
181156 }
182157 }
183158 public function select ($ table ,$ clause =[],$ after ="" )
@@ -229,7 +204,7 @@ public function select($table,$clause=[],$after="")
229204 }
230205 catch (PDOException $ e )
231206 {
232- error_page ($ e ->getMessage ());
207+ $ this -> error_page ($ e ->getMessage ());
233208 }
234209 }
235210 public function count ($ table ,$ clause =[])
@@ -280,7 +255,7 @@ public function count($table,$clause=[])
280255 }
281256 catch (PDOException $ e )
282257 {
283- error_page ($ e ->getMessage ());
258+ $ this -> error_page ($ e ->getMessage ());
284259 }
285260 }
286261 public function delete ($ table ,$ clause =[])
@@ -330,7 +305,7 @@ public function delete($table,$clause=[])
330305 }
331306 catch (PDOException $ e )
332307 {
333- error_page ($ e ->getMessage ());
308+ $ this -> error_page ($ e ->getMessage ());
334309 }
335310 }
336311 public function insert ($ table ,$ values )
@@ -369,7 +344,7 @@ public function insert($table,$values)
369344 }
370345 catch (PDOException $ e )
371346 {
372- error_page ($ e ->getMessage ());
347+ $ this -> error_page ($ e ->getMessage ());
373348 }
374349 }
375350 public function update ($ table ,$ clause ,$ values )
@@ -439,16 +414,7 @@ public function update($table,$clause,$values)
439414 }
440415 catch (PDOException $ e )
441416 {
442- error_page ($ e ->getMessage ());
417+ $ this -> error_page ($ e ->getMessage ());
443418 }
444419 }
445420}
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