From 2b78e5cb3807a8e6483a650567cf9f74bbf5de0a Mon Sep 17 00:00:00 2001 From: "Namhyeon, Go" Date: Tue, 18 Jun 2019 16:20:14 +0900 Subject: [PATCH] Update database.php --- system/database.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/system/database.php b/system/database.php index 2d35fc1..cf59baf 100644 --- a/system/database.php +++ b/system/database.php @@ -381,9 +381,11 @@ if(!check_function_exists("get_bind_to_sql_select")) { // use simple distance if(!array_key_empty("simple_distance", $v)) { - $a = $v['simple_distance'][0]; - $b = $v['simple_distance'][1]; - $s1a[$k] = sprintf("abs(1.0 - (abs(%s - %s) / %s))", $b, $a, $a); + if(check_array_length($v['simple_distance'], 2) == 0) { + $a = $v['simple_distance'][1]; // percentage (range 0 to 1) + $b = $v['simple_distance'][0]; // field or number + $s1a[$k] = sprintf("abs(1.0 - (abs(%s - %s) / %s))", $b, $a, $a); + } } } }