It is necessary to enter in the database the password from the account in an encrypted form. It looks something like this: òøÜÜØòjl. When I send mysqli_query with this parameter from my script, it simply does not execute, although if I send it from phpMyAdmin, then everything works. By the way, if you send characters of the type "a, b, c ..." in the request - there is no problem.

mysqli_query($link, "INSERT INTO `users` (`Nickname`, `Password`) VALUES ('qwerty', 'òøÜâÜØÚòjl')"); 
  • What is the coding base? - Kison
  • Are there any errors running mysqli_query? - Kison
  • No, the function is just skipped. Those. all the code is quietly executed further, and the function seems to be not. - Puro
  • What about encoding? - Kison
  • The column has the latin1_swedish_ci encoding. - Puro

3 answers 3

If mysqli_query is not running, then an error has occurred.
If an error has occurred, one should not guess at the sky, why an underground knock can occur, but get an error message, read it , and fix it.

In order for mysqli to report errors, you need to write before connecting

 error_reporting(E_ALL); mysqli_report(MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT); 

In general, the corresponding field type should be set for binary data. In this case, varbinary should be used instead of varchar .

  • Progress has been made: Errormessage: Incorrect string value: '\ xF2 \ xF8 \ xDC \ xE2 \ xDC \ xD8 ...' for column 'Password' at row 1. - Puro
  • I think the column should be made of type varbinary - Ipatyev

In base64, encode it in some way and forget about any problems with encodings, etc.

I think it will suit me. At least, I can encrypt and decrypt via base64_encode and base64_decode. Thank you all for your help.

  • Keyword extra . Otherwise, I have already seen a system where root passwords from servers are stored in the database just in base64, without prior encryption. And base64 in the data with the naked eye can be seen and clearly how to decipher. - Mike
  • And what is this $ link, there? ... maybe the problem is in it? - Hasanagha Aliyev

Check the encoding, write it in your script - mysql_set_charset('utf8');

  • Try to write more detailed answers. Explain what is the basis of your statement? - Nicolas Chabanovsky