0
Create a previous store in mysql. Using Codeigniter 3 already configured to use the mysqli driver, I tried to receive the data returned by SP but was not successful.
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;
I made the call on CI 3 as follows:
$query = $this->db->query("call Sp_datareport(2016,1,1,1,@D1"));
When viewing $query->result() you got the following message:
> > 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
How do I access the value of @D1 from the mysql database via store Procedure?
I do not understand, you want to access a value that is passing in SP?
– Marcelo Diniz
Actually I pass some parameters, then run a query in the table saida_product and store the value within @D1. But I cannot access this value by codeigniter 3
– Israel Zebulon