From 58dcdc3d73290d24b243c35ff63814b387820e6a Mon Sep 17 00:00:00 2001 From: "Namhyeon, Go" Date: Wed, 21 Mar 2018 12:05:38 +0900 Subject: [PATCH] Update database.php --- system/database.php | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/system/database.php b/system/database.php index 31f55c0..76a5275 100644 --- a/system/database.php +++ b/system/database.php @@ -110,7 +110,7 @@ if(!function_exists("exec_db_query")) { } // execute statement (insert->execute(bind) or if not, sql->bind->execute) - $stmt_executed = $is_insert_with_bind ? @$stmt->execute($bind) : @$stmt->execute(); + $stmt_executed = $is_insert_with_bind ? $stmt->execute($bind) : $stmt->execute(); if($is_check_count == true) { if($stmt_executed && $stmt->rowCount() > 0) { @@ -187,6 +187,17 @@ if(!function_exists("get_page_range")) { } } +if(!function_exists("get_bind_to_sql_where")) { + // warning: variable k is not protected. do not use variable k and external variable without filter + function get_bind_to_sql_where($bind) { + $sql_where = ""; + foreach($bind as $k=>$v) { + $sql_where .= " and {$k} = :{$k}"; + } + return $sql_where; + } +} + // alias sql_query from exec_db_query if(!function_exists("sql_query")) { function sql_query($sql, $bind=array()) {