【问题标题】:Codeigniter Message: Parameter 3 to mysqli_stmt_bind_param() expected to be a reference, value given -- stmt_send_long_dataCodeigniter 消息:mysqli_stmt_bind_param() 的参数 3 应为参考,给定值 -- stmt_send_long_data
【发布时间】:2014-02-16 07:36:39
【问题描述】:

我正在使用 codeigniter,以下代码已经运行了很长时间,直到我的服务器更新到 PHP 5.4。我的要求是允许上传大型文件并将它们作为 blob 保存在 mysql 数据库中。我无法存储链接引用,所以这不是一个选项。

下面是我的代码。我得到的错误是

Message: Parameter 3 to mysqli_stmt_bind_param() expected to be a reference, value given

从外观上看,我通过引用传递所有内容。

任何帮助都会很棒。

function UploadFile($filepath, $contenttype, $fileext, $filename, $filesize)
{
    $stmt = $this->db->call_function('stmt_init',$this->db->conn_id);
    if($this->db->call_function('stmt_prepare',$stmt, 'INSERT INTO THE_TABLE (user_id, upload_description, upload, content_type, file_ext, file_name, file_size) VALUES(?,?,?,?,?,?,?)')) 
    {
        $clientId = $this->input->post('clientid');
        $desc = $this->input->post('uploaddescription');
        $userfile = $this->input->post('userfile');

        $param = 2;
        $chunkSize = 8192;

        $this->db->call_function('stmt_bind_param',$stmt, "isbssss", $clientId, $desc, $userfile, $contenttype, $fileext, $filename, $filesize);

        if ($fp = @fopen($_FILES['userfile']['tmp_name'], 'r')) 
        {
            while (!feof($fp)) 
            {

                $this->db->call_function('stmt_send_long_data',$stmt, $param, fread($fp,  $chunkSize));

            }
            fclose($fp);
        }

        $result_query = $this->db->call_function('stmt_execute', $stmt);

【问题讨论】:

    标签: php mysql codeigniter mysqli blob


    【解决方案1】:

    我终于找到答案了。

    Codeigniters 函数 $this->db->call_function 通过值而不是通过引用传递值。我删除了这个函数调用并直接调用了绑定参数并且它起作用了。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-04-13
      相关资源
      最近更新 更多