【问题标题】:Multiple queries in stored procedure not working in codeigniter存储过程中的多个查询在 codeigniter 中不起作用
【发布时间】:2021-01-11 13:17:29
【问题描述】:

需要从 3 个当前状态 =1 的表中获取所有行

$query =  $this->db->query("CALL GetALLDetails('1')");
$result = $query->result_array();
print_r($result);

存储过程:-

BEGIN
 select * from table1 where current_status = status;
 select * from table2 where current_status = status;
 select * from table3 where current_status = status;
END

我只得到第一个查询语句的结果。

【问题讨论】:

  • 也许使用事务?
  • @KUMAR 我可以确认我的场景在 CodeIgniter 中是否可行?其实我需要使用存储过程。谢谢!

标签: php codeigniter stored-procedures


【解决方案1】:
$this->db->trans_start();
$this->db->query('AN SQL QUERY...');
$this->db->query('ANOTHER SQL QUERY...');
$this->db->query('AND YET ANOTHER SQL  QUERY...');
$this->db->trans_complete(); 

注意:-有关交易的更多信息

【讨论】:

  • 他问的是如何在存储过程中处理,而不是在事务中处理!
猜你喜欢
  • 1970-01-01
  • 2021-10-12
  • 2014-09-23
  • 1970-01-01
  • 2017-03-28
  • 2019-06-03
  • 2016-05-19
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多