drccfl9407 2015-05-28 11:46
浏览 62

看不出为什么这不起作用 - UPDATE MySQL表[重复]

This question already has an answer here:

I have a series of input fields and checkboxes. One of which is this:

<input type="checkbox" class="checkbox_style" <?php if($rows1['make_up'] == 'Yes') {echo 'checked';} ?> name="make_up" id="make_up" value="yes" />

It is sent to a php script which defines the variable:

if (!empty($_POST['make_up'])){$make_up = "Yes";} else {$make_up = "No”;}

Then it should update accordingly.

$updatesql = ("UPDATE $table_name SET

        brazilian_waxing='$brazilian_waxing',
        hollywood_waxing='$hollywood_waxing',
        reflexology='$reflexology',
        indian_head_massage='$indian_head_massage',
        weight_loss_wraps='$weight_loss_wraps',
        body_exfoliation='$body_exfoliation',
        back_treatments='$back_treatments',
        eyelash_extension='$eyelash_extension',
        nail_enhancements='$nail_enhancements',
        eyelash_lift='$eyelash_lift',
        eyebrow_extension='$eyebrow_extension',
        make_up='$make_up'

    WHERE id='$user_id' LIMIT 1");

    if (mysqli_query($link, $updatesql)) {
        $_SESSION['username'] = $username_check;
        header('Location: ../../admin');        

    } else {
        echo "Error: " . $updatesql . "<br>" . mysqli_error($link);
    }

    mysqli_close($link);

I have 30+ others on the same script that all work fine but this one just wont update. Can anyone see a reason for this?

Thank you in advance for your help.

</div>
  • 写回答

1条回答 默认 最新

  • dsh125986083 2015-05-28 11:47
    关注

    Problem is with your update query. You dnt need to use limit with update query

    UPDATE $table_name SET
    
        make_up=‘$make_up’
    
        WHERE id='$user_id';
    
    评论

报告相同问题?

悬赏问题

  • ¥15 使用EMD去噪处理RML2016数据集时候的原理
  • ¥15 神经网络预测均方误差很小 但是图像上看着差别太大
  • ¥15 Oracle中如何从clob类型截取特定字符串后面的字符
  • ¥15 想通过pywinauto自动电机应用程序按钮,但是找不到应用程序按钮信息
  • ¥15 如何在炒股软件中,爬到我想看的日k线
  • ¥15 seatunnel 怎么配置Elasticsearch
  • ¥15 PSCAD安装问题 ERROR: Visual Studio 2013, 2015, 2017 or 2019 is not found in the system.
  • ¥15 (标签-MATLAB|关键词-多址)
  • ¥15 关于#MATLAB#的问题,如何解决?(相关搜索:信噪比,系统容量)
  • ¥500 52810做蓝牙接受端