Explorar o código

Fixing query.

Julio Montoya %!s(int64=11) %!d(string=hai) anos
pai
achega
37b222d683
Modificáronse 1 ficheiros con 3 adicións e 1 borrados
  1. 3 1
      main/inc/lib/course_category.lib.php

+ 3 - 1
main/inc/lib/course_category.lib.php

@@ -654,8 +654,10 @@ function searchCategoryByKeyword($keyword)
         $whereCondition = " AND a.access_url_id = ".api_get_current_access_url_id();
     }
 
+    $keyword = Database::escape_string($keyword);
+
     $sql = "SELECT c.*, c.name as text FROM $tableCategory c $conditions
-            WHERE c.code LIKE '%$keyword%' AND name LIKE '%$keyword%' AND auth_course_child = 'TRUE' $whereCondition ";
+            WHERE (BINARY c.code LIKE '%$keyword%' or BINARY name LIKE '%$keyword%') AND auth_course_child = 'TRUE' $whereCondition ";
     $result = Database::query($sql);
     return Database::store_result($result, 'ASSOC');
 }