PHP implements a simple database operation class _ PHP Tutorial

Source: Internet
Author: User
PHP implements a simple database operation class. PHP implements a simple database operation Class PHP to implement a simple database operation class function: -set the connected character set during instantiation-a simple database operation class implemented by PHP during instantiation
PHP implements a simple function of the database operation class: -you can set the connection character set during instantiation-connect to the database during instantiation-select the default database during instantiation-disable the database code when destroying objects as follows:

  Server = $ server; $ this-> username = $ username; $ this-> password = $ password; $ this-> default_db = $ default_db; // connect to the database $ this-> link = mysql_connect ($ this-> server, $ this-> username, $ this-> password); if (! $ This-> link) {echo 'database connect failure! ';} // Set the default database $ bool = mysql_select_db ($ this-> default_db, $ this-> link); if (! $ Bool) {echo 'Select default_db failure! ';}}// Declare the destructor public function _ destruct () {mysql_close ($ this-> link );}}

PHP implements a simple function of database operation class:-connection character set can be set during instantiation-during instantiation...

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.