php the file doesn't correctly display a kirillian.



  • On the button, get out. $status and in Russian, and in the browser,

    {"response":"\u042d\u0442\u0430 \u044d\u043b\u0435\u043a\u0442\u0440\u043e\u043d\u043d\u0430\u044f \u043f\u043e\u0447\u0442\u0430 \u0443\u0436\u0435 \u0437\u0430\u043d\u044f\u0442\u0430"}
    

    I understand that this problem is probably a simple solution. Please.

    php file

    <?php
    

    require "init.php";

    $name = $_GET["name"];
    $surname = $_GET["surname"];
    $patronymic = $_GET["patronymic"];
    $email = $_GET["email"];
    $phone = $_GET["phone"];
    $password = $_GET["password"];

    $sql = "select * from registered_users where email = '$email'";

    $result = mysqli_query($con,$sql);

    if(mysqli_num_rows($result)>0)
    {
    $status = "Эта электронная почта уже занята";
    }
    else
    {
    $sql = "insert into registered_users(name,surname,patronymic,email,phone,password) values('$name','$surname','$patronymic','$email','$phone','$password');";

    if(mysqli_query($con,$sql))
    {
        $status = "ok";
    }
    else
    {
        $status = "error";
    }
    

    }
    echo json_encode(array("response"=>$status));

    mysqli_close($con);

    ?>



  • The paper should be read. ♪ ♪ echo json_encode(array("response"=> $status), JSON_UNESCAPED_UNICODE);And read about your database's security requests. https://www.php.net/manual/ru/mysqli.quickstart.prepared-statements.php


Log in to reply
 


Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2