How to implement DEDECMS external database calls

Source: Internet
Author: User

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.

Related Article

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.