我只是尝试将我的sql查询转换为codeigniter语法,但我却做不到
UPDATE tblUserController
INNER JOIN tblUser on tblUserController.FK_userID = tblUser.id
SET tblUserController.passwordWrong = 1, tblUserController.updatedAt = '2019-10-04 12:19:51'
WHERE tblUserController.FK_userID = '2'
AND ( tblUserController.FK_loggedID = '1' OR tblUser.updatedAt < DATE_ADD(NOW(), INTERVAL 3 HOUR) )
最佳答案
您可以这样使用:
$sqlRawQuery = "UPDATE tblUserController
INNER JOIN tblUser on tblUserController.FK_userID = tblUser.id
SET tblUserController.passwordWrong = 1, tblUserController.updatedAt = '2019-10-04 12:19:51'
WHERE tblUserController.FK_userID = '2'
AND ( tblUserController.FK_loggedID = '1'
OR tblUser.updatedAt < DATE_ADD(NOW(), INTERVAL 3 HOUR) )
";
$this->db->query($sqlRawQuery);
关于php - 如何从Mysql查询转换为Codeigniter语法?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/58229570/