가능한 중복 :
How can you run a mysqli query with CodeIgniter?PHP에서 STMT 쿼리를 준비
내가 php.But에서 실행하는 것을 시도하고 그것이 나에게 SQL을주고있다 MySQL의 쿼리를했습니다 codeigniter에서 구문 오류가 발생했습니다. 동일한 검색어를 붙여 넣은 후 에서 @uid
및 @rangee
을 올바른 값으로 바꿔서 복사하면 제대로 작동합니다.
$this->db->query("
SET @uid = ".mysqli_real_escape_string($conid,$userid).";
SET @rangee = ".mysqli_real_escape_string($conid,$attempt)." * 50;
PREPARE STMT FROM
'
UPDATE
notificationrecievers
SET notificationrecievers.status=1
WHERE notificationrecievers.status=0 and notificationrecievers.recieverid=? and
notificationrecievers.notificationid <=
(
SELECT MAX(notid) FROM
(
SELECT n.notid FROM user u,notifications n,notificationrecievers nr WHERE
nr.recieverid=? AND u.userid=n.senderid AND nr.notificationid=n.notid ORDER BY n.notid DESC
LIMIT 50 OFFSET ?
)e
)
AND
notificationrecievers.notificationid >=
(
SELECT min(notid) FROM
(
SELECT n.notid FROM user u,notifications n,notificationrecievers nr WHERE
nr.recieverid=? AND u.userid=n.senderid AND nr.notificationid=n.notid ORDER BY n.notid DESC
LIMIT 50 OFFSET ?
)g
);';
EXECUTE STMT USING @uid,@uid,@rangee,@uid,@rangee;");
이 왜 나에게 오류를주고있다 : 여기
쿼리입니까?
음과 같이 준비된 명령문의 PHP 래퍼를 사용한다, 어떤 오류 그것은 당신을주고있다? – Amber