更新查询无效 - 需要查看

时间:2016-01-27 17:46:52

标签: php mysql

任何人都可以在查询中告诉我哪里错了。数据库不更新而不管值

<?php

// ================= UPDATE =========================
if ($_POST['SUBMIT']=='SUBMIT')
{
    $fixture_id = "$_GET[id]";
    $m_date = "$_POST[match_date]";
    $m_time = "$_POST[match_time]";
    $m_report = "$_POST[match_report]";
    $m_a_result = "$_POST[team_a_result]";
    $m_b_result = "$_POST[team_b_result]";

$updt = mysql_query("UPDATE `fixture` SET match_date='$m_date', match_time='$m_time', match_report='$m_report', match_a_result='$m_a_result', match_b_result='$m_b_result', status = 1 WHERE id = '$fixture_id'");

header("location:view_fixture.php?msg= You have inserted result successfully...");              

}
else
{
header("location:result_update.php?msg= Something went wrong...");              

}

// ================================================================================
?>

1 个答案:

答案 0 :(得分:0)

在执行此操作之前,请确保您的提交按钮的字符串值为“SUBMIT”

试试这个..

<?php

    $fixture_id = $_GET[id];

if ($_POST['SUBMIT']=='SUBMIT')
{
    $m_date = $_POST['match_date'];
    $m_time = $_POST['match_time'];
    $m_report = $_POST['match_report'];
    $m_a_result = $_POST['team_a_result'];
    $m_b_result = $_POST['team_b_result'];

$updt = mysql_query("UPDATE `fixture` SET match_date= '$m_date', match_time='$m_time', match_report='$m_report', match_a_result='$m_a_result', match_b_result='$m_b_result', status = 1 WHERE id = '$fixture_id'");

header("location:view_fixture.php?msg= You have inserted result successfully...");              

}
else
{
header("location:result_update.php?msg= Something went wrong...");              

}


?>

请不要使用mysql_ *。现已弃用

相关问题