From 52e9012a1465e0b86fd824c25254716d3161a3a4 Mon Sep 17 00:00:00 2001 From: "Namhyeon, Go" Date: Wed, 16 Oct 2019 19:59:14 +0900 Subject: [PATCH] Update database.php --- system/database.php | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/system/database.php b/system/database.php index 4b1a150..70912da 100644 --- a/system/database.php +++ b/system/database.php @@ -378,6 +378,26 @@ if(!check_function_exists("get_bind_to_sql_where")) { } else { $s3 .= sprintf(" %s (%s like %s)", $opts[0], get_value_in_array($opts[1][1], $s1a, $opts[1][1]), "'%{$opts[1][2]}%'"); } + } elseif($opts[1][0] == "left") { + if(check_array_length($opts[1][2], 0) > 0) { + $s3a = array(); + foreach($opts[1][2] as $word) { + $s3a[] = sprintf("%s like '%s'", get_value_in_array($opts[1][1], $s1a, $opts[1][1]), "{$word}%"); + } + $s3 .= sprintf(" %s (%s)", $opts[0], implode(" and ", $s3a)); + } else { + $s3 .= sprintf(" %s (%s like %s)", $opts[0], get_value_in_array($opts[1][1], $s1a, $opts[1][1]), "'{$opts[1][2]}%'"); + } + } elseif($opts[1][0] == "right") { + if(check_array_length($opts[1][2], 0) > 0) { + $s3a = array(); + foreach($opts[1][2] as $word) { + $s3a[] = sprintf("%s like '%s'", get_value_in_array($opts[1][1], $s1a, $opts[1][1]), "%{$word}"); + } + $s3 .= sprintf(" %s (%s)", $opts[0], implode(" and ", $s3a)); + } else { + $s3 .= sprintf(" %s (%s like %s)", $opts[0], get_value_in_array($opts[1][1], $s1a, $opts[1][1]), "'%{$opts[1][2]}'"); + } } elseif($opts[1][0] == "in") { if(check_array_length($opts[1][2], 0) > 0) { $s3 .= sprintf(" %s (%s in ('%s'))", $opts[0], $opts[1][1], implode("', '", $opts[1][2]));