Considerations on the selection of database and its related software in PHP development

Source: Internet
Author: User
Tags mysql

PHP version is different, has stopped upgrading the development of the 4.0 series of 4.4.x, but now there are some production environment running this version, need to continue to maintain the code. The PHP 5.0 series is the mainstream version of the current development and application, with 5.1.x and 5.2.x series. PHP 6.0 is still a trial version, and people who develop software products in PHP can now do compatibility testing beforehand.

PHP supports a number of databases, including PHP's own database-driven components, such as Mysql.dll, Oci_oracle, and so on. PHP is pushing its common database driver component PDO from 5.1, and through this highly abstract database access component, PHP can support the vast majority of current database products, and this number is increasing, with great scalability. Third-party manufacturers have long been developing ADODB database access components, and are still moving forward.

PHP itself supports the database components, currently the most popular is the MySQL component. The PHP4.0 and version 5.0 support for Oracle uses a different set of functions, 5.0 compatible with 4.0, but the function name has been replaced. The PHP4.0 uses functions such as Ocilogon (), Ociparse (), Ociexecute (), Ocifetchinto (). and PHP5.0 with Oci_connect (), Oci_parse, Oci_bind_by_name (), Oci_execute (), Oci_fetch_all () and so on functions, can be seen to the MySQL function named close. These functions are in C language to expand the development of PHP, theoretically most efficient, but perhaps because of the lack of information and other reasons, the use of people do not seem to see much. Its paging code for Oracle tables is also more complex.

and the ADODB component and Windows asp.net use the ADO component packaging is almost the same, do asp/asp.net + access/ms-sqlserver development of people should déjà vu, very easy to get started. So, to do ms-sqlserver or Oracle development with PHP, ADODB should be considered. ADODB for PHP version 4.0 and 5.0 are supported, and PDO only support more than 5.1 PHP version, this should also be considered, do not do the project problem, do the product, it is necessary to consider the applicability of the version and software deployment environment.

A code example of PHP using the ADODB component to access the Oracle9i database:

<?php

Require_once ("adodb/adodb.inc.php"); Contains the ADODB class library

$db = Adonewconnection ("Oci8″"); Specify Oracle8.0 above database

$db->connect ("Mydb9″, Scott", "Tiger"); Three parameters are database network service name, user (scheme) and password respectively

$rs = $db->execute ("SELECT * from emp"); Execute SQL statement

Take data from a record

while (! $rs->eof)

{

Echo $rs->fields[job]. ' <br> ';

$rs->movenext ();

}

?>



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.