在mysql中创建存储过程。使用CodeIgniter 3已经配置为使用mysqli驱动程序,我试图接收SP返回的数据,但没有成功。 SP:
CREATE DEFINER=`root`@`localhost` PROCEDURE `SP_DadosRelatorio`(IN ano INT, IN mes INT, IN retirada INT, IN produto INT,
OUT d1 INT)
BEGIN
SELECT
ifnull(sum(qtde),0) INTO d1
FROM
saida_produto
WHERE EXTRACT(YEAR FROM data_saida) = ano
and
EXTRACT(MONTH FROM data_saida) = mes
and
EXTRACT(DAY FROM data_saida) = 1
and tipo_retirada = retirada
and id_produto = produto;
我在CI 3中打了电话: $ query = $ this-> db-> query("调用SP_DadosRelatorio(2016,1,1,1,@ d1"));
调用函数$ query-> result();我收到以下消息:
> > object(CI_DB_mysqli_result)[51] public 'conn_id' =>
> object(mysqli)[18]
> public 'affected_rows' => null
> public 'client_info' => null
> public 'client_version' => null
> public 'connect_errno' => null
> public 'connect_error' => null
> public 'errno' => null
> public 'error' => null
> public 'error_list' => null
> public 'field_count' => null
> public 'host_info' => null
> public 'info' => null
> public 'insert_id' => null
> public 'server_info' => null
> public 'server_version' => null
> public 'stat' => null
> public 'sqlstate' => null
> public 'protocol_version' => null
> public 'thread_id' => null
> public 'warning_count' => null public 'result_id' => boolean true public 'result_array' =>
> array (size=0)
> empty public 'result_object' =>
> array (size=0)
> empty public 'custom_result_object' =>
> array (size=0)
> empty public 'current_row' => int 0 public 'num_rows' => null public 'row_data' => null
如何通过IC3中的存储过程访问来自mysql数据库的@ d1的值?
当我尝试执行$ query-> result(); PHP告诉我:
A PHP Error was encountered
Severity: Error
Message: Call to a member function fetch_object() on boolean
Filename: mysqli/mysqli_result.php