<?php
$serverName = "192.168.1.2";
$connectionOptions = array('Database'=>'PKUSKH_2016', 'UID'=>'sa', 'PWD'=>'');
$conn = sqlsrv_connect( $serverName, $connectionOptions);
if( $conn === false )
{
echo "Could not connect.\n";
die( print_r( sqlsrv_errors(), true));
}
else {
echo "koneksi berhasil..!";
echo "Data item :";
$tsql = "select KODEKELAS,NAMAKELAS from dbo.REF_";
$result = sqlsrv_query($conn, $tsql);
while($row = sqlsrv_fetch_array($result))
{
echo($row['KODEKELAS'] . ', '.
$row['NAMAKELAS'].'<br>');
}
sqlsrv_close($conn);
}
?>