Answer the question
In order to leave comments, you need to log in
How to write data via php to MS SQL database (not MySQL) in windows-1251 encoding?
There is a form of recording in the database, of course, there is also code that almost successfully implements this, but not in the correct encoding.
Who can help?
<?php
require 'db.php';
$id = $_POST['id'];
$reason = $_POST['reason'];
$comment = $_POST['comment'];
$approve_name = $_POST['approve_name'];
$appr = $_POST['appr'];
print_r($_POST);
if($reason != '') {
$upd_data = $DBH->prepare("SET NAMES cp1251; UPDATE SCUD2 SET reason=:reason, comment=:comment WHERE SCUDID=:id");
$upd_data->execute(array(
'id'=>$id,
'reason'=>$reason,
'comment'=>$comment,
));
}
if($approve_name != '') {
if($appr == '') {
$approve_name = '';
}
$upd_data = $DBH->prepare("SET NAMES cp1251; UPDATE SCUD SET state=:state, approve_name=:approve_name WHERE SCUDID=:id");
$upd_data->execute(array(
'id'=>$id,
'state'=>$appr,
'approve_name'=>$approve_name,
));
}
?>
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question