Php5.3 and later versions connect to sqlserver2000. Php5.3 and later versions connect to sqlserver2000. php5.3 recently worked on a system to capture data from several tables in the Butler database and display the data on the web page, so I searched for the method for connecting to sqlserver2000 in php5.3 and later versions, php5.3
Recently, I was working on a system to capture data from several tables in the Butler database and display the data on the web page. I searched the Internet for how php connects to the sqlserver2000 Database. many textbooks on the Internet require php configuration. ini configuration file, remove; extension = php_mssql.dll; ", copy and paste php_mssql.dll in the ext file to the system32 directory of the system disk, and then restart the apache server, then write the code to connect to the database: <? Php $ conn = mssql_connect ("server", "database username", "database password"); mssql_selected ('"", $ conn);?> Generally, the server is written in the format of "ip, port number", which can be written as localhost, port or 127.0.0.1. as for how to write data according to your own situation, we hereby declare that the above connection to the SQL Server database is only available in php version 5.3. If you are connected to a version later than 5.3, it is not supported by php5.3 or later. The following describes how to connect to a database of sqlserver2000 or a later version of php5.3.
How can I connect to the sqlserver database in php5.3 or later versions? I have also found a lot of information about the download driver. The driver is only for the sqlserver2005 or 2008 database version, and Microsoft does not provide the relevant support driver for the sqlserver2000 version, at least I did not find it. if you want to talk about it later, let's take a look at my php5.3 and later methods for connecting to sqlserver2000. In fact, it is easy to connect to the 2000 database using odbc. Next, you need to configure the data source, open the Control Panel, find the management tool, open the management tool, and double-click open data source (ODBC ),
Select system DSN and click add
Select SQL server and next. of course, if you are using another database, such as access, you choose the acess driver.
The name must be written, which is a required parameter for you to write code to connect to the database. The server must also be selected. if it is the local machine, select the visible name if it is another machine.
The login ID must be written, that is, the name used to access your database. the password is also the password used to access the database. if there is a login ID, write it. if there is no login ID, leave it blank. then, the next step will be completed, test the connection. if you click "test connection", congratulations. your connection to sqlserver2000 with php5.3 or later is successful. The next step is to write the database connection code.
The code I wrote is directly attached below for your reference:
<? Php $ conn = odbc_connect ("name of the data source just configured", "name of the database accessed", "password of the database accessed"); $ SQL = "select * from table name "; $ exec = odbc_exec ($ conn, $ SQL); // execute the statement while (odbc_fetch_array ($ exec) {$ abc = odbc_result ($ exec, '"data table field name"); echo $ abc ...}
I hope this article will be helpful to anyone who needs it. I have summarized this article and found a lot of information. it should be said that it is the most detailed article connecting php5.3 and later versions to sqlserver2000.
How does php536 connect to SQL server2000?
After php5.3.x, you need to install Microsoft's php driver. php itself does not provide the SQL Server driver. Please refer to my log:
Hi.baidu.com/...1.html
Php connection to sql2000
PHP can be connected to MSSQL.
1. first, ms SQL Client Tools is a dll called ntwdblib. dll, which is usually copied to the system32 folder of the system after ms SQL Server is installed. if SQL Server is local, you need to verify that ntwdblib is used. the dll version is the same as that of SQL Server (2005 corresponds to 2000.80.194.0, 2000 corresponds to 2000.2.8.0;) If SQL Server is remote, you need to set the ntwdblib. copy the dll to the system32 folder of the current machine;
(A common problem here is that if php <通常是较老的ntwdblib.dll> If it is later than SQL Server installation, ntwdblib. dll of php will overwrite ntwdblib. dll of copy under system32 during SQL server installation. as a result, the link is prompted: the link cannot be connected to the database)
2. after verifying ntwdblib. dll under system32, you must overwrite ntwdblib. dll of the correct version in the php folder;
3. the ms SQL Server method is similar to that of MySQL;
As follows:
// Link to the database
$ Conn = mssql_connect ('IBM-F24B11ED1CCSQLEXPRESS ', 'sa', '123 ');
Mssql_select_db ('labmis ',? $ Conn );
// Query statement
$ Query = "select * from admin ";
$ AdminResult = mssql_query ($ Query );
// Output result
$ Num = mssql_num_rows ($ AdminResult );
For ($ I = 0; $ I <$ Num; $ I ++)
{
$ Row = mssql_fetch_array ($ AdminResult );
Echo ($ Row [1]);
Echo (" ");
}
?>
Recently, I was working on a system to capture data from several tables in the Butler database and display it on the web page. so I searched the internet...