I have to make a FOR in PHP using SQLSRV. I'm using the penultimate version of PHP and not the last one, as I can not update PHP.
I have to make a FOR in PHP using SQLSRV. I'm using the penultimate version of PHP and not the last one, as I can not update PHP.
Something you can use is sqlsrv_fetch_array
$sql = "SELECT FirstName, LastName FROM SomeTable";
$stmt = sqlsrv_query( $conn, $sql );
if( $stmt === false) {
die( print_r( sqlsrv_errors(), true) );
}
while( $row = sqlsrv_fetch_array( $stmt, SQLSRV_FETCH_ASSOC) ) {
echo $row['LastName'].", ".$row['FirstName']."<br />";
}