gpt4 book ai didi

php - PHP 中的 Codeigniter 和 Mysql 程序

转载 作者:行者123 更新时间:2023-11-30 23:34:50 24 4
gpt4 key购买 nike

我该如何使用?

我的程序库

<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Procedure
{
var $CI;
public $result = NULL; // Dönen Değer Değişkeni

public function __construct()
{
$this->CI = & get_instance();

}

public function query($sql)
{
// Sql Sorgusunu Çalıştır Sonucu resulta At
$this->result = $this->CI->db->query($sql);
// Procedure İçin Yazılmış
while(mysqli_next_result($this->CI->db->conn_id)){
if($l_result = mysqli_store_result($this->CI->db->conn_id)){
mysqli_free_result($l_result);
}
}
// Procedure İçin Yazılmış
// Sonucu Döndür
return $this->result;
}
}
?>

1 - 2 查询和结果:没问题

4 - 5 查询和结果:

Commands out of sync; you can’t run this command now 

没有确切的结果?使用

最佳答案

为什么不只返回 CI 结果对象?

$this->result = $this->CI->db->query($sql, TRUE)->result();

...而不是使用您的 while 循环? CI 可能已经运行了循环,并且所有结果都已被释放......

关于php - PHP 中的 Codeigniter 和 Mysql 程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8347683/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com