When using thinkphp to connect to the sqlserver database, it prompts 'The system does not support: sqlsrv'

WBOY
Release: 2016-08-08 09:23:59
Original
1486 people have browsed it

I am used to using a combination of php and mysql. Now when I receive a project and need to call the data of the customer's offline system software, I understand that the database of this software uses the sqlserver database, which is often called the mssql database.

So now I need to use PHP to connect to the sqlserver database, and then query the data I need based on conditions. How to do it? It would definitely be more troublesome to write it natively in PHP. In comparison, the Thinkphp framework that I have been using provides a sqlserver database driver, and I plan to use this to call data.

1. First, get the remote database connection address, user name, password, database name, and port from the customer (it is worth mentioning that if the port of the sqlserver database cannot be connected using: colon, try changing it to an English comma)

2. Install thinkphp first, I won’t go into that.

3. Modify the thinkphp database file. How did you set it up when you connected to mysql before? How do you set it up now? You need to change one place. Change the value of db_type to sqlsrv. Here is the setting of the database type.

4. Call it in the controller method. Try using dump to print the query table statement to see if the array can be printed successfully.

5. If unsuccessful, first check whether the database connection information is correct. If it is correct, then you need to configure the system environment (configure PHP to support the extension of the sqlserver database). For the method of configuring the system environment, please refer to my other article

Article address: http://www.cnblogs.com/phpyangbo/p/thinkphp-sqlserver-lianjie.html

The above introduces the prompt "The system does not support: sqlsrv" when using thinkphp to connect to the sqlserver database, including the relevant 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