There are different PHP versions. The upgrade and development of 4.0 series 4.4.x has been stopped. However, some production environments are still running this version and the code needs to continue to be maintained. The PHP 5.0 series is the mainstream version currently developed and applied, including the 5.1.x and 5.2.x series. PHP 6.0 is still a trial version, and people who develop software products using PHP can now conduct compatibility testing in advance.
PHP supports many databases, including PHP’s own database driver components, such as mysql.dll, oci_oracle, etc. PHP is promoting its universal database driver component PDO from version 5.1 onwards. Through this highly abstract database access component, PHP can support most of the current database products, and the number is still increasing, with great scalability. Third-party manufacturers have been developing ADODB database access components for a long time and are still making progress.
Among the database components supported by PHP itself, the most popular one currently is the MySQL component. PHP 4.0 and 5.0 use different function groups to support Oracle. 5.0 is compatible with 4.0, but the function names have 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(), oci_fetch_all(), etc. It can be seen that it is closer to MySQL's function naming. These functions are developed using C language to extend PHP, and are theoretically the most efficient. However, perhaps due to lack of information and other reasons, not many people seem to use them. Its paging code for Oracle tables is also relatively complex.
The ADODB component is almost identical to the ADO component packaging used by ASP.NET under Windows. People who have done ASP/ASP.NET + ACCESS/MS-SQLServer development should be familiar with it and it is easy to get started. Therefore, if you use 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 above. This should also be considered. It is not a big problem when doing projects. For products, you must consider the applicability of the version and the deployment environment of the software. .
A code example of PHP using ADODB component to access Oracle9i database:
require_once("adodb/adodb.inc.php"); // Contains ADODB class library
$db = ADONewConnection("oci8"); //Specify Oracle8.0 or above database
$db->Connect("mydb9", "scott", " tiger"); //The three parameters are the database network service name, user (scheme) and password
$rs = $db->Execute("select * from emp"); //Execute SQL Statement
//Get the data in the record
while (!$rs->EOF)
{
echo $rs->fields [JOB] .'
';
$rs->MoveNext();
}
?>