How can connect my mssql dtabase to my website i am using this code:
<?php
$user= 'abhi';
$pass = '';
$db_conn = new PDO('mssql:host=localhost;dbname= Abhishek', $user, $pass);
?>
How can connect my mssql dtabase to my website i am using this code:
<?php
$user= 'abhi';
$pass = '';
$db_conn = new PDO('mssql:host=localhost;dbname= Abhishek', $user, $pass);
?>
I know it's not exactly what you're asking, but do you really want to connect manually to a database and create your own sql?, with all dangers and annoying coding with it?
If I were you I'd use something lightweight like Medoo - will save you a lot of time.
see https://medoo.in
<?php
require 'vendor/autoload.php';
use Medoo\Medoo;
$database = new Medoo([
'database_type' => 'mssql',
'database_name' => 'name',
'server' => 'localhost',
'username' => 'your_username',
'password' => 'your_password'
]);
$result = $database->select("account", [
"user_name",
"email"
];