CodeIgniter 3:错误号2014命令不同步;您现在不能运行此命令 [英] CodeIgniter 3: Error Number 2014 Commands out of sync; you can't run this command now
本文介绍了CodeIgniter 3:错误号2014命令不同步;您现在不能运行此命令的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
每次我在CodeIgniter 3中调用第二个存储过程(insert_staff_logs)时,都会收到2014年MySQL错误号.
I am receiving MySQL error number 2014 every time I call the 2nd stored procedure (insert_staff_logs) in CodeIgniter 3.
这是生成的完整错误:
发生数据库错误
错误号: 2014
命令不同步;您不能立即运行此命令
呼叫insert_staff_logs('1000',now(),'LOGIN')
文件名:C:/wamp/www/db2/system/database/DB_driver.php
行号: 691
这是我的模特:
class Login_model extends CI_Model
{
public function login($data)
{
$query = $this->db->query("CALL login_auth('".$data['username']."','".$data['password']."')");
if($query->num_rows() == 1)
{
return $query->result();
}else
{
return false;
}
}
public function staff_logs($data)
{
$query = $this->db->query("CALL insert_staff_logs('".$data."',now(),'LOGIN')");
}
}
这是我的存储过程:
DELIMITER $$
CREATE
/*[DEFINER = { user | CURRENT_USER }]*/
PROCEDURE `must_empc_db`.`insert_staff_logs`(id VARCHAR(10),s VARCHAR(50))
BEGIN
INSERT INTO tblstafflogs(`staffID`,`timestamp`,`session`)
VALUES(id,NOW(),s);
END$$
DELIMITER ;
有人对此有解决方案吗?非常感谢您的答复.谢谢!
Does anyone has solution on this? Your reply is much appreciated. Thanks!
推荐答案
class Login_model extends CI_Model
{
public function login($data)
{
if (mysqli_more_results($this->db->conn_id)) {
mysqli_next_result($this->db->conn_id);
}
$query = $this->db>query("CALLlogin_auth('".$data['username']."','".$data['password']."')");
if($query->num_rows() == 1)
{
return $query->result();
}
else
{
return false;
}
}
public function staff_logs($data)
{
if (mysqli_more_results($this->db->conn_id)) {
mysqli_next_result($this->db->conn_id);
}
$query = $this->db->query("CALL insert_staff_logs('".$data."',now(),'LOGIN')");
}
}
这篇关于CodeIgniter 3:错误号2014命令不同步;您现在不能运行此命令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文