PHP – call SQL Server stored procedure in codeigniter

Good night
I am writing to you because I have the following problem. Please can you guide me or help me with a solution.

I have the following SP in SQL Server:

ALTER procedure (dbo). (Sp_test1)
@ int output records


set @ records = 1 + 1

Choose @register


And I want to restore the value of this output variable "@registers" in Codeigniter, but I can not just return null

This is my model:

public function getNumber () {

$ query = $ this-> db-> query ("DECLARE @ int records EXEC SP_PRUEBA1 @ records = @ records OUTPUT SELECT @ records");

return $ query-> result_array ();


If I'm wrong, please your guide, I will appreciate it, thank you very much.