0
I’m trying to display data from a table in my database SQL Server, using the PHP, but I’m not getting it. Not error code but also returns nothing.
The code is this one:
<?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);
?>
has two SELECT in the query, leaves only one
– Wees Smith
If you use the same SQL statement in the database is returned something ? What’s in your
$query
with thevar_dump
?– 8biT