Let Mayfish support MYSQLI database-driven implementation _javascript techniques

Source: Internet
Author: User

Some of the differences between MySQL and mysqli are found on the Internet:
MySQL is a non-holding relay function and MYSQLI is a permanent connection function. Other words
MySQL each link will open a connected process and mysqli run mysqli multiple times will use the same connection process, thereby reducing the cost of the server

Because of the recent time, the site also because of the increase in traffic, and has been the process occupied by the problem. Therefore, in order to reduce the overhead of the process, a set of mysqli drivers are added for the mayfish framework. Let's take a look at how to work with the mysqli driver under Mayfish.

In the Configs directory, modify the MySQL settings file, for example: database.php
See the following, this is a default use of MySQL driver example.

Copy Code code as follows:

Conf (' db_host ', ' localhost ');
Conf (' Db_user ', ' root ');
Conf (' Db_password ', ' 123456 ');
Conf (' db_name ', ' u112741 ');
Conf (' Db_prefix ', ' mfs_ ');
Conf (' db_charset ', ' UTF8 ');


We will change him into
Copy Code code as follows:

Conf (' Driver ', ' mysqli ');
Conf (' db_host ', ' localhost ');
Conf (' Db_user ', ' root ');
Conf (' Db_password ', ' 123456 ');
Conf (' db_name ', ' u112741 ');
Conf (' Db_prefix ', ' mfs_ ');
Conf (' db_charset ', ' UTF8 ');


In this case, MFS will work in a mysqli way when he is at work.

At the same time, the update also added to the database query error logging function to facilitate debugging errors. The Open method is: Modify the configs/config.php file:
Conf ("Logs", true); Add open error logging feature (default: TRUE)

The latest version of Mayfish's download address is: http://www.jb51.net/codes/20169.html

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.