I'm trying to display data from a table in my SQL Server database using PHP, but I'm not getting it. The code does not error but also returns nothing.
The code is this here:
<?php
$serverName = "MIRCIA-PC\PRIMAVERA";
$resultadoectionInfo = array( "Database"=>"PRICVE", "UID"=>"sa", "PWD"=>"INFODMIDMI99" );
$resultado = sqlsrv_connect( $serverName, $resultadoectionInfo);
if( $resultado === false ) {
die( print_r( sqlsrv_errors(), true));
}
$query=sqlsrv_query($resultado,"SELECT SELECT Artigo, Descricao, STKMaximo, STKMinimo, STKActual FROM Artigo");
if($query){
while($row=sqlsrv_fetch_array($query)){
$flag[]=$row;
}
print (json_encode($flag));
}
sqlsrv_close($resultado);
?>