Dedecms How to complete 2 database content calls to each other? This is what I want to share with us today. Baidu has a big pile, mostly vague. Common sense is limited, so just say the author's approach, can have other useful ways, farewell to share. The author site is Dedecms5.7+php+mysql, and the Space Support database external call, this is the precondition.
1, dedecms5.6 above as the support of such a database external call, open file/data/tag/sql.inc.php file, database connection, respectively:
Otherdb Database Connection Equipment
// ------------------------------------------------------------------------
$sqltag [' Otherdb '] [' dbhost '] = ' database IP ';
$sqltag [' Otherdb '] [' dbname '] = ' database name ';
$sqltag [' Otherdb '] [' dbuser '] = ' database user name ';
$sqltag [' Otherdb '] [' dbpwd '] = ' database password ';
$sqltag [' Otherdb '] [' dbprefix '] = ' database table prefix, tacitly dede_ ';
$sqltag [' Otherdb '] [' dblanguage '] = ' coding pattern, such as UTF8, gb2312 ';
Storage can be, remember the cohesion title Otherdb.
2. Log in to the called Space Control Panel and add the authorized IP in the database panel, that is, the empty-forward IP that called the database. For example, strange space can be strange, if there is no space quotient can be consulted, can 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"}
[field:title/]
{/dede:sql}
SQL queries are strong enough to invoke whatever you want.
So that you can complete the external database call, is not very simple
How to complete the Dede CMS external database call | Different database call data