Please help to understand, on some cells the request to the database does not go through, called this way:
$stmt = mysqli_prepare($connection, "UPDATE `table` SET `data` = ? WHERE `table`.`data` = ?"); mysqli_stmt_bind_param($stmt, 'ss', $newcontent, $originalcontent); mysqli_stmt_execute($stmt); For example, if the contents of the data cell:
<img src="http://dd.com/1.jpg"> - then everything goes fine.
What if:
г<img src="http://dd.com/1.jpg"> - then the value in the cell is not updated. If in a cell instead of a Russian letter is a Latin or a digit, then everything goes fine.
From this we can conclude that the most likely problem is in the encoding.
When connecting to the database I use the query:
mysqli_query($dbconnection,"SET CHARACTER SET 'utf8'"); I thought that he would solve all the encoding problems (until that moment he solved, all characters are displayed correctly both when outputting and when entering data into the database - but for the WHERE condition, this is probably not enough).
Tell me, please, how php can solve this problem.
г? In the browser in the input field you score or on the server you find out in some way (in the logs for example)? Maybe the wrong encoding comes from the browser - Sergeyecho $originalcontent;. The browser almost does not participate at all with me, only initiates the launch of the script. The script processes data from the database - where Russian letters are, the condition is not met. - federk 2:58 pmгformed programmatically? Somewhere in the text of the program is written the type of such$str = "г" + чего-то там? The encoding of the text of the program what? windows 1251, koi8, utf-8? - Sergeyгalready contained in the database that the program is processing. The coding of the program text itself is utf-8 - federkmysqli_set_charset()This is the preferred way to specify a character set. The use ofmysqli_query()functions (for example,SET NAMES utf8) for this purpose is not recommended. Maybe your case is exactly - Sergey