When you try to register, the following error occurs:
Warning: Illegal string offset 'user_login' in .... \ db_register.php on line 32
In this case, the record in the database occurs in the correct form!
Registration File:
<?php require_once 'include/db_functions.php'; $db = new db_functions(); // json response array $response = array("error" => FALSE); if (isset($_POST['user_login']) && isset($_POST['user_password']) && isset($_POST['user_name']) && isset($_POST['user_middle_name']) && isset($_POST['user_last_name']) && isset($_POST['user_group'])) { // receiving the post params $user_login = $_POST['user_login']; $password = $_POST['user_password']; $user_name = $_POST['user_name']; $user_middle_name = $_POST['user_middle_name']; $user_last_name = $_POST['user_last_name']; $user_group = $_POST['user_group']; // check if user is already existed with the same login if ($db->isUserExisted($user_login)) { // user already existed $response["error"] = TRUE; $response["error_msg"] = "User " . $user_login . " already exists"; echo json_encode($response); } else { // create a new user $user = $db->storeUser($user_login, $password, $user_name, $user_middle_name, $user_last_name, $user_group); if ($user) { **袨楔袠袘袣袗 袩袪袨袠小啸袨袛袠孝 袟袛袝小鞋, 袙袨 袙小袝啸 小袥袝袛校挟些袠啸 袩袨袥携啸 $response** $response["error"] = FALSE; $response["uid"] = $user["user_uniqueid"]; $response["user"]["user_login"] = $user["user_login"]; $response["user"]["user_name"] = $user["user_name"]; $response["user"]["user_middle_name"] = $user["user_middle_name"]; $response["user"]["created_at"] = $user["created_at"]; echo json_encode($response); } else { // user failed to store $response["error"] = TRUE; $response["error_msg"] = "Failed to store"; echo json_encode($response); } } } else { $response["error"] = TRUE; $response["error_msg"] = "Fill up all fields!"; echo json_encode($response); } ?>