PHP connect with MsSQL

Posted on 2005-05-08
Last Modified: 2008-02-07
Dear all experts,

i'm using mssql_connect to connect to MsSQL like that

however, it appeared an error msg "Fatal error: Call to undefined function: mssql_connect() in ....... .."

i dunno why ?! .. and cannot found the solution!
i jz want to connect remote msSQL to retrieve some data from there!
please help me and give me some example or reference site!

Thank you very much!
Question by:kankan
    LVL 10

    Accepted Solution


    Did you setup (uncomment) your mssql extension in your PHP.INI file...

    change this....


    to this....


    Did you install 'ntwdblib.dll' into your system directory! c:/winnt or c:/windows

    After doing this make sure shut down your server, if using IIS shutdown restart Internet Services


    Author Comment

    hi Suzanne,

    then if i use odbc one will be better ?
    coz i don't want to install anything in the Linux to avoid missing dll during setup the second server!
    but i try to use odbc function as well, it has some problem raise up!
    so, duuno what's wrong!


    Author Comment

    when using odbc_connect(), the error as below :
    "Warning: odbc_connect(): SQL error: [unixODBC][Driver Manager]Data source name not found, and no default driver specified, SQL state IM002 in SQLConnect in ................
    [unixODBC][Driver Manager]Data source name not found, and no default driver specified"

    Please give me some hints to solve it!

    LVL 14

    Expert Comment

    No comment has been added to this question in more than 21 days, so it is now classified as abandoned..
    I will leave the following recommendation for this question in the Cleanup topic area:
    Accept: mensuck

    Any objections should be posted here in the next 4 days. After that time, the question will be closed.

    EE Cleanup Volunteer

    Featured Post

    IT, Stop Being Called Into Every Meeting

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    Join & Write a Comment

    Popularity Can Be Measured Sometimes we deal with questions of popularity, and we need a way to collect opinions from our clients.  This article shows a simple teaching example of how we might elect a favorite color by letting our clients vote for …
    I imagine that there are some, like me, who require a way of getting currency exchange rates for implementation in web project from time to time, so I thought I would share a solution that I have developed for this purpose. It turns out that Yaho…
    The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
    The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

    734 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    21 Experts available now in Live!

    Get 1:1 Help Now