Home > Backend Development > PHP Tutorial > SQL Server database created on Navicat premium, realize connection using PHP (that is, php connects to Microsoft MSSQL), navicatpremium_PHP tutorial

SQL Server database created on Navicat premium, realize connection using PHP (that is, php connects to Microsoft MSSQL), navicatpremium_PHP tutorial

WBOY
Release: 2016-07-12 09:03:57
Original
1171 people have browsed it

The SQL Server database created on Navicat premium can be connected with PHP (that is, PHP connects to Microsoft MSSQL). navicatpremium

can be used in Sybase’s db-lib or The ct-lib library also contains an ODBC library. Allows many applications to connect to Sybase or Microsoft SQL servers;

Use FreeTDS under windows

 What is FreeTDS? FreeTDS is actually an open source (or can be said to be free) C program library, which can access and operate Microsoft's SQL database under the Linux 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

2. Add:

to the php configuration file /PHP/php.ini

extension=php_dblib.dll 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

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/1077131.htmlTechArticleThe SQL Server database created on Navicat premium can be connected with PHP (that is, php is connected to Microsoft MSSQL). Navicatpremium can The db-lib or ct-lib library used in Sybase also contains a...
Related labels:
php
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