How to complete the Dede CMS external database call | Different database call data

Source: Internet
Author: User

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

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.