<?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);
}
?>
Asked
Active
Viewed 25 times
0

aynber
- 22,380
- 8
- 50
- 63

khoirun nisa
- 11
-
2take at least 5mins to write a proper question so that people are motivated to help – B001ᛦ Jun 20 '18 at 13:20
-
1Read the error message and it will tell you what's wrong. sqlserver2000 is too old for the odbc driver. – aynber Jun 20 '18 at 13:25
-
1Okay, so that's a decent block of code, what's wrong with it? Care to add even a small amount of text to say what you are doing, what you expect to happen, and what is happening? – Can O' Spam Jun 20 '18 at 13:25
-
1The best solution would be to upgrade to a version of sql server that is still supported. sql server 2000 has been out of support for close to a decade now. The two major version released AFTER sql 2000 are out of support which should give you an indication of far out of date your system is. – Sean Lange Jun 20 '18 at 13:28
-
thank for answers. I try connect sql server with php version 1.7.7 can It. but I try connect sql server with version up cann't it. – khoirun nisa Jun 20 '18 at 13:39