0

ライブ更新用の Web ページ (php) に MySQL データベースを表示しています。私は AJAX が初めてで、データベースを更新するためのページを取得できません。助けてくれてありがとう。JavaScript と AJAX コードは次のとおりです。

if(send == "send")
{

$.ajax({
type: "POST",
url: "table_edit_ajax.php",
data: dataString,
cache: false,
success: function(html)
{
$("#Receiving_" + ID).html(Receiving);
   $("#Rreg_" + ID).html(Rreg);
        $("#Sending_" + ID).html(Sending);
        $("#Sreg_" + ID).html(Sreg);
        $("#Name_" + ID).html(Name);
        $("#Received_" + ID).html(Received);
        $("#ToRC_" + ID).html(ToRC);
        $("#Approved_" + ID).html(Approved);
        $("#Denied_" + ID).html(Denied);
        $("#Notes_" + ID).html(Notes);
        $("#Status_" + ID).html(Status);
        $("#Send_" + ID).html(Send);
        $("#Notified_" + ID).html(Notified);
}
});
}
else 
{
$.ajax({
type: "POST",
url: "table_edit.php",
data: dataString,
cache: false,
success: function(html)
{
$("#Receiving_" + ID).html(Receiving);
   $("#Rreg_" + ID).html(Rreg);
        $("#Sending_" + ID).html(Sending);
        $("#Sreg_" + ID).html(Sreg);
        $("#Name_" + ID).html(Name);
        $("#Received_" + ID).html(Received);
        $("#ToRC_" + ID).html(ToRC);
        $("#Approved_" + ID).html(Approved);
        $("#Denied_" + ID).html(Denied);
        $("#Notes_" + ID).html(Notes);
        $("#Status_" + ID).html(Status);
        $("#Send_" + ID).html(Send);
        $("#Notified_" + ID).html(Notified);
}
});
}

});

接続後にデータベースを更新する PHP コードは次のとおりです。

$id=mysql_escape_String($_POST['id']);
$Receiving=mysql_escape_String($_POST['Receiving']);
$Rreg=mysql_escape_String($_POST['Rreg']);
$Sending=mysql_escape_String($_POST['Sending']);
$Sreg=mysql_escape_String($_POST['Sreg']);
$Name=mysql_escape_String($_POST['Name']);
$Received=mysql_escape_String($_POST['Received']);
$ToRC=mysql_escape_String($_POST['ToRC']);
$Approved=mysql_escape_String($_POST['Approved']);
$Denied=mysql_escape_String($_POST['Denied']);
$Notes=mysql_escape_String($_POST['Notes']);
$Status=mysql_escape_String($_POST['Status']);
$Send=mysql_escape_String($_POST['Send']);
$Notified=mysql_escape_String($_POST['Notified']);
$sql = "update transfers set 
Receiving='$Receiving',
Rreg='$Rreg',
Sending='$Sending',
Sreg='$Sreg',
Name='$Name',
Received='$Received',
ToRC='$ToRC',
Approved='$Approved',
Denied='$Denied',
Notes='$Notes',
Status='$Status',
Send='$Send',
Notified='$Notified'
where id='$id'";
mysql_query($sql);
?>

助けてくれてありがとう。必要に応じて、メイン ドキュメントの本文を投稿して表を編集します。

4

0 に答える 0