Intermediary transaction http://www.aliyun.com/zixun/aggregation/6858.html ">seo diagnose Taobao guest cloud host technology Hall
Dedecms How do you implement 2 database contents to call each other? This is what I want to share with you today. Baidu a lot of, mostly vague. Knowledge is limited, so say the author's practice, there may be other effective methods, welcome to share. The author site is Dedecms5.7+php+mysql, and the space supports the external call of the database, this is the prerequisite.
1, dedecms5.6 above seems to support this kind of database external call, open file/data/tag/sql.inc.php file, database connection, respectively:
Otherdb Database Connection Configuration
// ------------------------------------------------------------------------
$sqltag [' Otherdb '] [' dbhost '] = ' database IP ';
$sqltag [' Otherdb '] [' dbname '] = ' database name ';
$sqltag [' Otherdb '] [' dbuser '] = ' database username ';
$sqltag [' Otherdb '] [' dbpwd '] = ' database password ';
$sqltag [' Otherdb '] [' dbprefix '] = ' database table prefix, default for Dede_ ';
$sqltag [' Otherdb '] [' dblanguage '] = ' coded format, such as UTF8, gb2312 ';
Save it, remember the connection name Otherdb.
2, landing is called the Space Control Panel, in the database panel to add authorization IP, that is, call the database of the null IP. The following diagram, different space may be different, if there is no room for consultation, whether the support.
3, make data call, here can use dede:sql tag.
{dede:sql sql= "select * from dede_archives by id desc limit 0,10" appname= "Otherdb"}
<a href= "/plus/view.php?aid=[field:tmd/]" >[field:title/]</a>
{/dede:sql}
SQL queries are powerful and call directly on what you want to call.
This can be implemented outside the database call, is not very simple, but Baidu is not found. This article original 365 Opportunity Network http://sj.zsw365.com, the first A5, welcome with the link reprint.