php5.3 later versions connect sqlserver2000 method, php5.3_php tutorial

Source: Internet
Author: User
Tags sql client sql server driver

php5.3 later versions connect sqlserver2000 method, php5.3


Recently in a system to crawl the steward database inside a few tables of data display in the Web page, and then surf the internet to search for PHP how to connect sqlserver2000 database, online Many textbooks are to configure PHP.ini configuration files, remove; extension=php_ Mssql.dll in front of the semicolon ";", and then the ext file inside Php_mssql.dll copy paste into the system disk System32 directory, and then restart the Apache server, and then write the code to connect the database: <?php $conn =mssql_ Connect ("Server", "Database user name", "Database Password"); mssql_selected (' corresponding database name ', $conn);? > Server General writing format is "IP, port number" how to be native, can be written as localhost, port or 127.0.0.1, port. As for how to write according to your own circumstances, hereby declares that the above connection to SQL Server database is limited to PHP version 5.3. If you are more than 5.3 of the version above the connection is also not available, because php5.3 above version of Microsoft is not supported. The following is how to connect php5.3 or above version of sqlserver2000 or above database.

So how does the php5.3 version connect to the SQL Server database? Because of this I also found a lot of information, there is said download driver, can be driven only for sqlserver2005 or 2008 database version, and for sqlserver2000 version of Microsoft also did not provide related support driver, at least I did not find, good gossip less say, or let me introduce my php5.3 above version of the connection sqlserver2000 method. In fact, it is very simple to connect the 2000 database with ODBC. Following the next step, you first need to configure the data source, open the Control Panel, find the Administrative tools, open the Administrative tools, and then double-click Open Data Source (ODBC),

Select the System DSN, and then click Add

Select SQL Server, and then next, of course, if you are a different database such as access then you choose acess to switch off the driver first.

The name must be written, which is the necessary parameter for you to write the code connection to access the database. The server must also choose, if it is the machine to choose local, if it is the other machine to choose the name that can be seen.

Login ID must write, is to access the name of your database, password is also access to the database password, if there is a write, no empty, and then the next step to know to complete, and then test the connection, if you click the test Connection prompt success then congratulations, Your php5.3 above version connection sqlserver2000 succeeds, then the next step is to write the code to connect the database.

The following is directly attached to the code I wrote for your reference:

<?php$conn=odbc_connect ("The data source name just configured", "Access database name", "Access database Password"), $sql = "SELECT * from table name"; $exec =odbc_exec ($conn, $sql) ;//EXECUTE statement while (Odbc_fetch_array ($exec)) {$abc =odbc_result ($exec, ' "Data table corresponding to field name"); Echo $abc ...}

Hope this article to the needs of friends have help, can say this article is my own summed up, find a lot of information, should be said to be the most detailed php5.3 above version of the connection sqlserver2000 article.


php536 How to connect with SQL server2000

After the php5.3.x version, you need to install the Microsoft PHP driver, PHP itself no longer provide SQL Server driver. Please refer to my blog:
Hi.baidu.com/...1.html

PHP Connection sql2000 problem

PHP can be fully connected to the MSSQL.

1. First, MS SQL Client Tools is a DLL called Ntwdblib.dll, which is typically copied to the system's System32 folder after MS SQL Server installation, and if SQL Server is local, Then you need to verify that the version of the Ntwdblib.dll is consistent with the version of SQL Server (2005 corresponds to 2000.80.194.0,2000 2000.2.8.0;) If SQL Server is remote, Need to copy that Ntwdblib.dll to the System32 folder of the machine;
(one of the frequently encountered problems here is that if PHP <通常是较老的ntwdblib.dll> Typically older ntwdblib.dll> are installed later than SQL Server, PHP ntwdblib.dll will overwrite the SQL When the server is installed, copy is ntwdblib.dll under System32, causing the link to be prompt: Link is not on the database)
2. After verifying the Ntwdblib.dll under System32, you also need to overwrite the correct version of Ntwdblib.dll with the Ntwdblib.dll under the PHP folder;
3. The method of using MS SQL Server is similar to the MySQL method;
as follows:

!--? php
//link Database
$conn =mssql_connect (' ibm-f24b11ed1ccsqlexpress ', ' sa ', ' 123456 ');
mssql_select_db (' Labmis ',? $conn);
//query statement
$Query = "SELECT * from admin";
$AdminResult =mssql_query ($Query);
//Output
$Num =mssql_num_rows ($AdminResult);
for ($i =0; $i < $Num; $i + +)
{
$Row =mssql_fetch_array ($AdminResult);
Echo ($Row [1]);
Echo (" ");
}
?>
 

http://www.bkjia.com/PHPjc/851345.html www.bkjia.com true http://www.bkjia.com/PHPjc/851345.html techarticle php5.3 later version of the method of connection sqlserver2000, php5.3 recently in doing a system to crawl the data of several tables inside the steward database display in the Web page, so the internet search a bit ...

  • Related Article

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.