Home > Backend Development > PHP Tutorial > The SQL Server database created on Navicat premium enables PHP connection, that is, php connection to Microsoft MSSQL.

The SQL Server database created on Navicat premium enables PHP connection, that is, php connection to Microsoft MSSQL.

WBOY
Release: 2016-07-29 09:11:11
Original
2766 people have browsed it

Can be used in Sybase’s db-lib or ct-lib library, which also contains an ODBC library. Allows many application software to connect to Sybase or Microsoft SQL server;

Use FreeTDS under windows

  What is FreeTDS? FreeTDS is actually an open source (or can be said to be free) C library, which can be implemented in Linux Access and operate Microsoft's SQL database under the system. FreeTDS is released as source code, and because of this, it can be compiled and installed on almost any system.

If your server is a Windows system, then you should use php_dblib.dll. (more information on Using FreeTDS for Unix.)

1: Follow the link below to download php_dblib.dll and save it to the /PHP/ext folder.

https: //docs.moodle.org/30/en/Installing_MSSQL_for_PHP#Using_the_SQL_Server_2005_Driver_for_PHP_from_Microsoft_on_Windows

在Navicat premium上创建的<strong>SQL Server</strong>database, realize using PHP connection, that is, php to connect to Microsoft MSSQL

2. In php Add:

extension=php_dblib.dll to the configuration file /PHP/php.ini Restart apache

3: Test:

1    <?<span>php
</span>2        <span>$link</span> = mssql_connect('localhost', 'db_user', 'db_password'<span>);
</span>3        <span>if</span>(!<span>$link</span><span>) {
</span>4            <span>echo</span>'Could not connect'<span>;
</span>5            <span>die</span>('Could not connect: ' .<span> mssql_error());
</span>6<span>        }
</span>7        <span>echo</span>'Successful connection'<span>;
</span>8        mssql_close(<span>$link</span><span>);
</span>9    ?>
Copy after login

ok, success!!!

Reference: http://www.th7.cn /Program/php/201303/129462.shtml

The above introduces the SQL Server database created on Navicat premium, and realizes the use of PHP connection, that is, php to connect to Microsoft MSSQL, including aspects of the content. I hope it will be helpful to friends who are interested in PHP tutorials.

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template