From 5125540d7ec826b91bac78a2ebd60957941de4e3 Mon Sep 17 00:00:00 2001 From: Nikolai R Kristiansen Date: Thu, 23 Jul 2015 21:32:10 +0200 Subject: [PATCH] Fixes searching with utf-8 chars, minor fixes --- api/api_functions.php | 4 +++- api/user.php | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/api/api_functions.php b/api/api_functions.php index 6cd1ccb..4cc66f7 100644 --- a/api/api_functions.php +++ b/api/api_functions.php @@ -46,6 +46,8 @@ function get_db_connection($fetch_mode=NULL, $options=NULL) { $conn->setFetchMode($fetch_mode); } } + /* Set character set */ + $conn->query('SET NAMES utf8'); return $conn; } @@ -147,7 +149,7 @@ function get_user_data($ids) { } elseif($key == "cards") { if($value === "") { - continue; // no groups + continue; // no cards } $result[$key] = _get_cards($value); } diff --git a/api/user.php b/api/user.php index b251512..c339e47 100644 --- a/api/user.php +++ b/api/user.php @@ -120,7 +120,7 @@ if( DB::isError($res) ) { if( count($res) === 0 ) { echo json_encode(array( - 'meta' => array('num_results' => 0), + 'meta' => array('num_results' => 0, 'query' => $sql), 'results' => array() )); die();