Koneksi codeigniter,php dan Sql Server 2008
Koneksi Php dan Sql Server 2008
conn.php
<?php
$serverName="SANCESE-PC";
$conn=new PDO("sqlsrv:server=$serverName;Database=dbSance");
if($conn){
echo "Connect </br>";
}else{
echo "gagal";
die(print_r(sqlsrv_errors(),true));
}
$sql='select * from tbSance';
foreach($conn->query($sql)as $row){
print $row['Nama'] ."\t";
print $row['alamat']."\t";
print $row['nim']."</br>";
}
?>
Atw Dengan Menggunakan user dan Pass
<?php
$serverName="SANCESE-PC";
$conn=new PDO("sqlsrv:server=$serverName;Database=dbSance","sa","123456");
if($conn){
echo "Connect </br>";
}else{
echo "gagal";
die(print_r(sqlsrv_errors(),true));
}
$sql='select * from tbSance';
foreach($conn->query($sql)as $row){
print $row['Nama'] ."\t";
print $row['alamat']."\t";
print $row['nim']."</br>";
}
?>
Lakukan kode Diatas sebelum Konnek menggunakan Code Igniter
Setingan Config/database.php
karna terkadang eror jika langsung disetting langsung kebawah.
jika bisa tidak masalah kode diatas untuk memancing sajah.
$active_group = 'default';
$active_record = TRUE;
$db['default']['hostname'] = 'SANCESE-PC';
//$db['default']['port'] = 1433;
$db['default']['username'] = 'sa';
$db['default']['password'] = '123456';
$db['default']['database'] = 'dbSance';
$db['default']['dbdriver'] = 'sqlsrv';
$db['default']['dbprefix'] = '';
$db['default']['pconnect'] = FALSE;//////////TRUE
$db['default']['db_debug'] = TRUE;
$db['default']['cache_on'] = FALSE;
$db['default']['cachedir'] = '';
$db['default']['char_set'] = 'utf8';
$db['default']['dbcollat'] = 'utf8_general_ci';
$db['default']['swap_pre'] = '';
$db['default']['autoinit'] = TRUE;
$db['default']['stricton'] = FALSE;
Aplikasi Download
http://sance1.blogspot.co.id/2017/03/aplikasi-download.html
Alamat Youtube
https://www.youtube.com/watch?v=8gRrbUBThm4
Download from Youtube above
https://drive.google.com/open?id=1bI6DaZTolMwwTqvdG5jDhNnSB3DqGJD6
<?php
$serverName="SANCESE-PC";
$conn=new PDO("sqlsrv:server=$serverName;Database=dbSance");
if($conn){
echo "Connect </br>";
}else{
echo "gagal";
die(print_r(sqlsrv_errors(),true));
}
$sql='select * from tbSance';
foreach($conn->query($sql)as $row){
print $row['Nama'] ."\t";
print $row['alamat']."\t";
print $row['nim']."</br>";
}
?>
Atw Dengan Menggunakan user dan Pass
<?php
$serverName="SANCESE-PC";
$conn=new PDO("sqlsrv:server=$serverName;Database=dbSance","sa","123456");
if($conn){
echo "Connect </br>";
}else{
echo "gagal";
die(print_r(sqlsrv_errors(),true));
}
$sql='select * from tbSance';
foreach($conn->query($sql)as $row){
print $row['Nama'] ."\t";
print $row['alamat']."\t";
print $row['nim']."</br>";
}
?>
Lakukan kode Diatas sebelum Konnek menggunakan Code Igniter
Setingan Config/database.php
karna terkadang eror jika langsung disetting langsung kebawah.
jika bisa tidak masalah kode diatas untuk memancing sajah.
$active_group = 'default';
$active_record = TRUE;
$db['default']['hostname'] = 'SANCESE-PC';
//$db['default']['port'] = 1433;
$db['default']['username'] = 'sa';
$db['default']['password'] = '123456';
$db['default']['database'] = 'dbSance';
$db['default']['dbdriver'] = 'sqlsrv';
$db['default']['dbprefix'] = '';
$db['default']['pconnect'] = FALSE;//////////TRUE
$db['default']['db_debug'] = TRUE;
$db['default']['cache_on'] = FALSE;
$db['default']['cachedir'] = '';
$db['default']['char_set'] = 'utf8';
$db['default']['dbcollat'] = 'utf8_general_ci';
$db['default']['swap_pre'] = '';
$db['default']['autoinit'] = TRUE;
$db['default']['stricton'] = FALSE;
Aplikasi Download
http://sance1.blogspot.co.id/2017/03/aplikasi-download.html
Alamat Youtube
https://www.youtube.com/watch?v=8gRrbUBThm4
Download from Youtube above
https://drive.google.com/open?id=1bI6DaZTolMwwTqvdG5jDhNnSB3DqGJD6
Koneksi codeigniter,php dan Sql Server 2008
Reviewed by Leo
on
11:20
Rating:
No comments