PHP versions vary, and the 4.0 series 4.4.x has been stopped for development. However, there are still some production environments running this version, and you need to continue to maintain the code. PHP 5.0 series is a mainstream development and application version, including 5.1.x and 5.2.x series. PHP 6.0 is still a trial version. developers who use PHP to develop software products can now perform compatibility tests in advance.
PHP supports many databases, including the database driver components that come with PHP, such as mysql. dll and oci_oracle. PHP versions later than 5.1 are pushing its general database driver component PDO. Through this highly abstract database access component, PHP can support the vast majority of database products currently, and this number is still increasing, great scalability. Third-party manufacturers have been developing ADODB database access components for a long time and are still in progress.
Currently, MySQL is the most popular database component supported by PHP. PHP4.0 and 5.0 use different function groups for Oracle Support. 5.0 is compatible with 4.0, but the function name has been changed. PHP4.0 uses functions such as OCILogon (), OCIParse (), OCIExecute (), and OCIFetchInto. PHP5.0 uses functions such as oci_connect (), oci_parse, oci_bind_by_name (), oci_execute (), and oci_fetch_all (). It can be seen that it is similar to the MySQL function name. These functions are extended and developed for PHP in C language, which is theoretically the most efficient. However, there may not be many users due to lack of information. Its paging code for Oracle tables is also complicated.
The ADODB component and ASP in Windows. the ADO component packages used by. NET are almost identical. They have been used in ASP/ASP. NET + ACCESS/MS-SQLServer developers should be familiar and easy to use. Therefore, when using PHP for MS-SQLServer or oracle development, ADODB should be considered. ADODB supports both PHP versions 4.0 and 5.0, while PDO only supports PHP versions 5.1 and later. This should also be considered. The problem of project implementation is not big, and it is a product, it is necessary to consider the applicability of the version and the deployment environment of the software.
Example code of using the ADODB component to access the Oracle9i database in PHP:
<? Php
Require_once ("adodb/adodb. inc. php"); // contains the ADODB class library
$ Db = ADONewConnection ("oci8"); // specify a database above Oracle8.0
$ Db-> Connect ("mydb9", "scott", "tiger"); // the three parameters are the database network service name, user (solution), and password.
$ Rs = $ db-> Execute ("select * from emp"); // Execute an SQL statement
// Retrieve the data in the record
While (! $ Rs-> EOF)
{
Echo $ rs-> fields [JOB]. '<br> ';
$ Rs-> MoveNext ();
}
?>