Thread: Connect to db

    #1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2008
    Posts
    244
    Rep Power
    11

    Connect to db


    Trying this

    $db = new PDO ("mssql:host=$hostname;dbname=$dbname";charset=utf8","$username","$password", $options);

    I have a website created on my server that also has the SQL Server on it. Just testing here.

    how do I specify my host name?
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Loyal (3000 - 3499 posts)

    Join Date
    Jul 2003
    Posts
    3,457
    Rep Power
    594
    PHP Code:
    $hostname="localhost"
    There are 10 kinds of people in the world. Those that understand binary and those that don't.
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2013
    Location
    Visakhapatnam
    Posts
    11
    Rep Power
    0
    Originally Posted by jaykappy
    Trying this

    $db = new PDO ("mssql:host=$hostname;dbname=$dbname";charset=utf8","$username","$password", $options);

    I have a website created on my server that also has the SQL Server on it. Just testing here.

    how do I specify my host name?
    $hostname='localhost';

    $dbname='your db name';

    The same with username and password.

IMN logo majestic logo threadwatch logo seochat tools logo