Home  >  Q&A  >  body text

Please ask the editor for the corresponding update.

The modification is successful. The normal number of affected rows printed in Sysdb.php is 1. The corresponding $res in admin.php = $this->db->table('admins')->where( ['id'=>$id])->update($data);var_dump($res);

The return is always NULL. Does anyone know what's going on? Please advise, thank you!

SynnSynn1282 days ago1353

reply all(7)I'll reply

  • xxxxx

    xxxxx2021-03-20 17:33:59

    QQ图片20210222145709.png Support the same request!

    reply
    0
  • Synn

    Did I forget to return in Sysdb?

    Synn · 2021-03-20 20:38:46
  • Pluto.

    Pluto.2021-03-18 16:04:05

    $res = $this->db->table('admins')->where('id',$id)->update($data); Try this

    reply
    0
  • Synn

    Neither method works. In this answer, if the modification is unsuccessful, the log returns UPDATE `admins` SET `username` = 'admin' , `gid` = 2 , `truename` = 'Mark' , `status` = 1 , `password` = '21232f297a57a5a743894a0e4a801fc3' WHERE `id` IS NULL [ RunTime:0.000270s ], the result is NULL

    Synn · 2021-03-18 21:30:12
    Synn

    Finally found the reason, thank you! !

    Synn · 2021-03-18 22:21:06
  • Pluto.

    Pluto.2021-03-18 16:03:22

    $res = $this->db->table('admins')->where(['id',$id)->update($data); Try this

    reply
    0
  • Synn

    This method reports POST http://www.aqiyi.cn/admins.php/admins/admin/save 500 (Internal Server Error), and the log reports [ error ] [0] Query expression error: 'id'[ C:\PHP\WWW\video\thinkphp\library\think\db\Builder.php:309], the modification is also unsuccessful. Both array(=>) and [=>] can be modified successfully, but only in admin.php The return value is NULL, and Sydb returns 1.

    Synn · 2021-03-18 21:36:00
  • Cancelreply