I am trying to communicate to a MSSQL Server database with PHP from a woocommerce website (to fetch data like products, categories etc.). But I get no results, here is my code:
$connectionInfo = array( "UID"=>$uid,
"PWD"=>$pwd,
"Database"=>$databaseName);
$conn = sqlsrv_connect( $serverName, $connectionInfo);
$tsql = "SELECT * FROM eshopItemsTable";
$stmt = sqlsrv_query($conn, $tsql);
//uncomment to get some results : $table = sqlsrv_fetch_array($stmt, SQLSRV_FETCH_ASSOC);
while( $table = sqlsrv_fetch_array($stmt, SQLSRV_FETCH_ASSOC) ) {
print_r($table);
}
sqlsrv_free_stmt( $stmt);
sqlsrv_close( $conn);
with this code it prints nothing. But if I uncomment the line above while then I get some results but I dont get all of them (there are ~2000 items in the db but I get something like 10 items without the first one - which is obvious because I already consume the first row). What is the proper way to get all the results?