The selection of database and its related software in PHP development

Source: Internet
Author: User
Tags php tutorial

PHP (PHP training PHP Tutorial) versions are different, has stopped upgrading the development of the 4.0 series of 4.4.x, but there are still some production environment in this version, need to continue to maintain code. The PHP 5.0 series is now the mainstream version of development and application, with 5.1.x and 5.2.x series. PHP 6.0 is currently a trial version, and people who develop software products with PHP can now pre-test for compatibility.

PHP supports a number of databases (database training database certification), including PHP itself with the database driver components, such as Mysql.dll, oci_oracle and so on. PHP is pushing its generic database driver, PDO, from version 5.1, and with this highly abstracted database access component, PHP can support most of the current database products, and this number is increasing, with great extensibility. Third-party manufacturers are already developing ADODB database Access Components (http://adodb.sourceforge.net/) and are still on the move.

PHP itself supports the database components, the most popular is the MySQL component. 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 already been replaced. PHP4.0 uses functions such as Ocilogon (), Ociparse (), Ociexecute (), and Ocifetchinto (). and PHP5.0 with Oci_connect (), Oci_parse, Oci_bind_by_name (), Oci_execute (), Oci_fetch_all () and so on, can be seen to the MySQL function named closer. These functions are developed in C language for PHP, which is the most efficient in theory, but perhaps because of the lack of data and other reasons, the use of people does not seem to be much. The paging code for Oracle tables is also more complex.

The ADODB component and the ADO component wrapper used by Windows ASP. Asp/asp.net + Access/ms-sqlserver developers should be familiar and easy to get started. So, with PHP for Ms-sqlserver or Oracle development, ADODB should be the list of considerations. ADODB for PHP 4.0 and 5.0 are supported, and PDO only support PHP version 5.1 or more, this should also consider that the project is not a problem, to 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:

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

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

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

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

Take the data from the record

while (! $rs->eof)

{

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

$rs->movenext ();

}

?>

The selection of database and its related software in PHP development

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.