SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Enthusiast
    Join Date
    Apr 2003
    Location
    United Kingdom
    Posts
    94
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Connecting to SQL server

    I have another question. I am trying to connect to a M$ SQL server with PHP. I have used the mssql_connect that I read about in the PHP manual. When I try the line below. I get the error message

    PHP Code:
    $connmssql_connect ('loca1''sa''password') or die ("connection error"); 
    Fatal error: Call to undefined function: mssql_connect() in D:\defaultWeb1\sql.php on line 2

    I assume this is the same as MySQL where you can just use the same line above but just with mysql_connect instead ?

    Can someone help here ?

    Thanks

  2. #2
    SitePoint Enthusiast Patrick Lucas's Avatar
    Join Date
    Dec 2001
    Location
    Ohio
    Posts
    77
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    MSSQL functions aren't installed by default on PHP. Check here on how to install it: http://us2.php.net/manual/en/ref.mssql.php

    You need to edit your php.ini file and add some .dll (for windows).




    I have my own MSSQL question I was hoping somebody could help me with. I've gotten as far as having the functions work, but it always says "can't connect to server" when I use mssql_connect(). The server and port are vaild... I'm thinking the problem is with the way I have it installed. I copied ntwdblib.dll as described on PHP.net and edited my ini file. Can anybody help me? [img]images/smilies/biggrin.gif[/img]
    Patrick Lucas

  3. #3
    SitePoint Enthusiast
    Join Date
    Apr 2003
    Location
    United Kingdom
    Posts
    94
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks I have looked at this but what the heck does this mean.. what is FreeTDS


    To get these functions to work, you have to compile PHP with --with-mssql[=DIR], where DIR is the FreeTDS install prefix. And FreeTDS should be compiled using --enable-msdblib.

  4. #4
    SitePoint Enthusiast
    Join Date
    Apr 2003
    Location
    United Kingdom
    Posts
    94
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ok I am still having a problem. I have installed the SQL extensions. extension=php_mssql.dll, which I uncommeneted. I also have the ntwdblib.dll file in the right place (In fact I have all the client tools installed ) and now when I try and connect to SQL I get the following error :

    Unknown(): Unable to load dynamic library'./php_mssql.dll' - The specified module could not be found..... Is there supposed to be a fille called php_mssql.dll installed anywhere on the PC ?

  5. #5
    SitePoint Enthusiast
    Join Date
    Apr 2003
    Location
    United Kingdom
    Posts
    94
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    yes I have. I have made sure the ntwdblib.dll is in my Windows\system32 and that the extension=php_mssql.dll is enabled in PHP.iNI.. However I am now getting the following error message when trying to do a mssql_connect..

    Unknown(): Unable to load dynamic library './php_mssql.dll' - The specified module cannot be found..

    Is this DLL supposed to be installed too, if so where do I get it, the manual does not say!!


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •