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