diff --git a/system/database.php b/system/database.php index 9975e12..598d982 100644 --- a/system/database.php +++ b/system/database.php @@ -1,7 +1,7 @@ 0) { + $is_insert_with_bind = true; + } + } $validOptions = array(); $optionAvailables = array("is_check_count", "is_commit"); @@ -83,12 +90,15 @@ if(!function_exists("exec_db_query")) { $dbc->beginTransaction(); } + // execute statement (insert->execute(bind), or if not sql->bind->execute) + $stmt_executed = $is_insert_with_bind ? @$stmt->execute($bind) : @$stmt->execute(); + if($is_check_count == true) { - if($stmt->execute() && $stmt->rowCount() > 0) { + if($stmt_executed && $stmt->rowCount() > 0) { $flag = true; } } else { - $flag = $stmt->execute(); + $flag = $stmt_executed; } if($is_commit) { @@ -115,7 +125,7 @@ if(!function_exists("exec_db_fetch_all")) { if(!function_exists("get_page_range")) { function get_page_range($page=1, $limit=0) { $append_sql = ""; - + if($limit > 0) { $record_start = ($page - 1) * $limit; $record_end = $record_start + $limit - 1;