mysql根据uid更新数据报错

萤火虫

sql语句:

    self::$db->update('dj_equipment')->cols(array('onLine'))->where('uid='.$uid)->bindValue('onLine', 1)->query();
报错信息:
    PDOException: SQL:UPDATE `dj_equipment` SET `onLine` = :onLine WHERE uid=DJ_5e78b3cf60813 SQLSTATE[42S22]: Column not found: 1054 Unknown column 'DJ_5e78b3cf60813' in 'where clause' in /root/GatewayWorker/vendor/mysql-master/src/Connection.php:1770
堆栈信息:
    Stack trace:
#0 /root/GatewayWorker/vendor/mysql-master/src/Connection.php(1828): Workerman\MySQL\Connection->execute('UPDATE `dj_equi...', Array)
#1 /root/GatewayWorker/Applications/YourApp/Events.php(59): Workerman\MySQL\Connection->query()
#2 [internal function]: Events::onMessage('7f0000010b54000...', '{"type":"bind",...')
#3 /root/GatewayWorker/vendor/workerman/gateway-worker/src/BusinessWorker.php(403): call_user_func('Events::onMessa...', '7f0000010b54000...', '{"type":"bind",...')
#4 /root/GatewayWorker/vendor/workerman/workerman/Connection/TcpConnection.php(657): GatewayWorker\BusinessWorker->onGatewayMessage(Object(Workerman\Connection\AsyncTcpConnection), Array)
#5 /root/GatewayWorker/vendor/workerman/workerman/Events/Select.php(292): Workerman\Connection\TcpConnection->baseRead(Resource id #42)
#6 /root/GatewayWorker/vendor/workerman/workerman/Worker.php(2401): Workerman\Events\Select->loop()
#7 /root/GatewayWorker/vendor/workerman/gateway-worker/src/BusinessWorker.php(197): Workerman\Worker->run()
#8 /root/GatewayWorker/vendor/workerman/workerman/Worker.php(1534): GatewayWorker\BusinessWorker->run()
#9 /root/GatewayWorker/vendor/workerman/workerman/Worker.php(1364): Workerman\Worker::forkOneWorkerForLinux(Object(GatewayWorker\BusinessWorker))
#10 /root/GatewayWorker/vendor/workerman/workerman/Worker.php(1338): Workerman\Worker::forkWorkersForLinux()
#11 /root/GatewayWorker/vendor/workerman/workerman/Worker.php(539): Workerman\Worker::forkWorkers()
#12 /root/GatewayWorker/start.php(39): Workerman\Worker::runAll()
#13 {main}
Worker[17419] process terminated
worker[YourAppBusinessWorker:17419] exit with status 64000
2725 2 0
2个回答

萤火虫

已解决!

  • fuqiang 2021-05-25

    请问如何解决的,求告知,谢谢!

phpcreeper

where语句改成这个试试:

where("uid='{$uid}'")
  • 暂无评论
年代过于久远,无法发表回答
×
🔝