[Original] ecmall pendant development: call non-ecmall database data

Source: Internet
Author: User
Comrades familiar with ecmall pendant development know that the key to getting data is the _ get_data () function in Main. Weight. php.
In this function, you can write SQL statements to obtain your own data.
Recently written Program Ecmall pendants are used to call data from other databases. Online Data retrieval is a tutorial to call the data of this database. Therefore, I found a method to call other databases, and I don't know the efficiency, please correct me.

function _ get_data ()
{< br> If (mysql_select_db ('databasename ') // select the database you need and use pure SQL statements. Databasename is the name of the database you want to call
{< br> $ db = & dB (); // create a database model, in the ecmall Data Model link call tutorial, you can find the function prototype
$ user = $ db-> getall ("select subject, TID from
pre_forum_thread order by views limit 10 "); // obtain the data you need and save it in
mysql_select_db ('ecmall '); // This sentence is critical, because in addition to this pendant, other pendants are called ecmall databases, so you need to change the data model of the default
to the data model of ecmall. Here, ecmall is the name of my local ecmall database
return $ user; // you can find the called data in widget.htm.
}

welcome to communicate with friends, actionbi2010@gmail.com

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.