3
Hello, I am developing an application using Laravel Framework Handler from my Backend and found the following error.
My Sqlserver Express 2008 R2 database has a stored Procedure that performs a series of routines and inserts the data already formatted into a table. stored Procedure receives a Key (Varchar) and the year (int) of the report I want to generate.
When I run a stored Procedure by Database script the insertion occurs correctly and I have all the data.
exec indicador.usp_indicador_101_1 'asdfgh', 2015
After running the process I run a method that performs the following select:
select * from indicador.T101_Indicador where A101_chave = 'asdfgh'
In the ideal scenario I have all results returned correctly:
But when I run the same code in PHP:
<?php
$server = "###.###.###.#";
$options = array( "UID" => "usuario", "PWD" => "senha", "Database" => "meubanco");
$conn = sqlsrv_connect($server, $options);
// Then execute the procedure
$proc = "exec indicador.usp_indicador_101_1 '147896311212', 2015";
$proc_result = sqlsrv_query($conn, $proc );
// Etc...
//mssql_free_statement($proc);
sqlsrv_close($conn);
?>
I have just the return of a line:
Stored Procedure makes the inserts by itself, the select of the data is done at another time. The photos shown are of selects made in the database script.
I tried in several ways the execution of stored Procedure, my last attempt was this with pure PHP and the return is always the same, only one line.
Selection in the application is done by a method using the Laravel features:
public static function T101_indicador($chave){
$dados = T101_indicador::where('A101_Chave', '=', $chave)
->orderBy('A101_Nomord')
->get();
//dd($dados);
return $dados;
}
There’s nothing missing from that code? Wouldn’t there be a
fetch_array()
thereabout?– rray
The process itself has no return, I run a select in the table later to access the data and I believe that there I should use the fetch_array().
– Jonatan Pietroski
So the problem is in select and not in SP, put there in the question the rest of the code.
– rray
I ran this code and gave the select in the Database script and it returns only one line.
– Jonatan Pietroski