connecting PHP with Remote MS SQL server 2005

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • rraajjuu
    New Member
    • Apr 2007
    • 2

    #1

    connecting PHP with Remote MS SQL server 2005

    Hi, friends
    I want to conect PHP5 with remote MS SQL Server 2005 but dont know how to connect getting many errors ; my code is :-

    [PHP]<?
    $server="IP Address";
    $username="sa";
    $password="";
    $sqlconnect=mss ql_connect($ser ver, $username, $password);
    $sqldb=mssql_se lect_db("Northw ind",$sqlconnec t);
    $sqlquery="SELE CT companyName FROM Customers;";
    $results= mssql_query($sq lquery);
    while ($row=mssql_fet ch_array($resul ts)){
    echo $row['companyName']."<br>\n";}
    mssql_close($sq lconnect);
    ?>[/PHP]

    I have uncommented following in PHP.ini
    php_mssql.dll
    and not having php_mssql.dll in php installation directory to keep in syste32 directory..
    so plz help me to connect .. It's very urgent . Thanks in advanced
    Last edited by Atli; Nov 8 '08, 10:25 AM. Reason: Added [code] tags.
  • Atli
    Recognized Expert Expert
    • Nov 2006
    • 5062

    #2
    Hi.

    What errors are you getting?

    Also, please use &#91;code] tags when posting your code examples.
    (See How to ask a question)

    &#91;code] ... Code goes here... &#91;/code]

    Thank you.
    Moderator

    Comment

    • rraajjuu
      New Member
      • Apr 2007
      • 2

      #3
      I m getting the error

      Fatal error: Call to undefined function mssql_connect() in D:\wamp\www\pr\ prev0~.php on line 5

      so plz tell me what I should to do...?

      Comment

      • Atli
        Recognized Expert Expert
        • Nov 2006
        • 5062

        #4
        Ok.

        Try the following:
        • Set the extension_dir directive in your php.ini config file to an absolute path to the ext dir in your PHP installation dir.
          For example: extension_dir = "C:\Program Files\PHP\ext"
        • Make sure that the "php_mssql. dll" file exists in that directory.
        • Uncomment (by removing the semi-colon from the start of the line) or add the extension DLL to the php.ini file.
          Like: extension=php_m ssql.dll
        • Restart the server.

        That should do it.

        Comment

        Working...