From 4ff759aa99402efe119020b25b4ef2861e893cf8 Mon Sep 17 00:00:00 2001 From: "Namhyeon, Go" Date: Fri, 29 Jun 2018 13:27:33 +0900 Subject: [PATCH] Update database.php --- system/database.php | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/system/database.php b/system/database.php index c56835f..be19613 100644 --- a/system/database.php +++ b/system/database.php @@ -7,9 +7,11 @@ */ if(!function_exists("get_db_connect")) { - function get_db_connect() { + function get_db_connect($a=32, $b=0) { $config = get_config(); + $conn = false; + try { $conn = new PDO( sprintf( @@ -23,7 +25,14 @@ if(!function_exists("get_db_connect")) { ); $conn->query("SET NAMES 'utf8'"); } catch(Exception $e) { - set_error($e->getMessage()); + if($b > $a) { + set_error($e->getMessage()); + show_errors(); + } else { + $b++; + sleep(0.03); + $conn = get_db_connect($a, $b); + } } return $conn;