doupin5408 2013-04-04 09:58
浏览 104

'where子句'中的未知列'member1'

after searching in google and SO,i decided to put this here.. i tried changing single quote and backtick to column but it didn't help either.. any help appreciated!!!

$a=mysql_query("UPDATE exercisemember SET reps='$reps' WHERE memid='$memid1'")       or die(mysql_error());

    $b=mysql_query("UPDATE exercisemember SET sets1='$sets1' WHERE memid='$memid1'")       or die(mysql_error());

Thanks in advances.. update 1 the member1 is actually the value of $memid1

  • 写回答

2条回答 默认 最新

  • dsxi70423 2013-04-04 10:08
    关注

    As your title says, there is no colimn member1. What the problem could be is that you you have qoute in the $memid.

    Please do an echo on $memid to see what is in the variabele.

    Also you could better use pdo or mysqli

    it will be something like this with pdo:

    //database connection
    $dbh = new PDO('mysql:host=localhost;dbname=test', $user, $pass);
    
    $sql = 'UPDATE exercisemember SET reps=:reps WHERE memid=:memid';
    $update = $dbh->prepare($sql);
    $update->bindParam(':reps', $reps, PDO::PARAM_STR); //if it is a integer use PDO::PARAM_INT
    $update->bindParam(':memid', $memid, PDO::PARAM_STR);
    $update->execute();
    

    This will prevent it from sql injection.

    评论

报告相同问题?

悬赏问题

  • ¥50 mac mini外接显示器 画质字体模糊
  • ¥15 TLS1.2协议通信解密
  • ¥40 图书信息管理系统程序编写
  • ¥20 Qcustomplot缩小曲线形状问题
  • ¥15 企业资源规划ERP沙盘模拟
  • ¥15 树莓派控制机械臂传输命令报错,显示摄像头不存在
  • ¥15 前端echarts坐标轴问题
  • ¥15 ad5933的I2C
  • ¥15 请问RTX4060的笔记本电脑可以训练yolov5模型吗?
  • ¥15 数学建模求思路及代码