Code Script PHP To Connection SQL with PHP

, , No Comments
Assalamualaikum...
Hello everybody... this is a code to connection your sql server 2008 r2. upss dont worries to copy and paste this code, because I am free give it for you to learning :)


<?php
$server="name_server";
$username="name_username";
$password="password";
$database="name_database";
$conn = new COM("ADODB.CONNECTION")
or die("Sory its problem in your connection, please check ");
$connect = "PROVIDER=SQLOLEDB; SERVER=".$server."; UID=".$username."; PWD=".$password.";
DATABASE=".$database;
$conn->open($connect);
?>

after you copy and paste that code then save file name example the name file is 'config.php' then open in your browser with name file you create. and if the script was running be perfect so congratulation and enjoy to coding but if eror so check in your server name, user name, password and database name.

Salam Sugesti ^_^

0 comments:

Post a Comment