doudieheng5322 2016-01-27 17:46
浏览 39
已采纳

更新查询无效 - 需要查看[关闭]

Can anyone tell where am I wrong in the query. The database in not updating irrespective of the value

<?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条回答 默认 最新

  • dongren4099 2016-01-27 17:55
    关注

    Before executing this make sure your submit button have a string value of "SUBMIT"

    Try this ..

    <?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...");              
    
    }
    
    
    ?>
    

    Please DO NOT USE mysql_* . It is now deprecated

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 outlook无法配置成功
  • ¥15 Pwm双极模式H桥驱动控制电机
  • ¥30 这是哪个作者做的宝宝起名网站
  • ¥60 版本过低apk如何修改可以兼容新的安卓系统
  • ¥25 由IPR导致的DRIVER_POWER_STATE_FAILURE蓝屏
  • ¥50 有数据,怎么建立模型求影响全要素生产率的因素
  • ¥50 有数据,怎么用matlab求全要素生产率
  • ¥15 TI的insta-spin例程
  • ¥15 完成下列问题完成下列问题
  • ¥15 C#算法问题, 不知道怎么处理这个数据的转换