Home > CMS Tutorial > DEDECMS > body text

How to nest sql statements in runphp=yes

藏色散人
Release: 2020-01-10 09:21:58
Original
2555 people have browsed it

How to nest sql statements in runphp=yes

How to nest sql statements inside runphp=yes?

runphp=yes has sql statements nested inside it

Recommended learning: 梦Weavercms

Everyone knows that there are many tags in DreamWeaver You can use runphp='yes', so that we can easily use PHP statements to achieve the results we want, but sometimes we even need to query some required results through SQL statements. Let's give an example to illustrate. :

For example, in dede:arclist, you can use [field:writer/] to call the author's name, and you can also use [field:mid/] to call the author's ID number, but you cannot directly obtain the author's ID number. space address. Then at this time we need to use SQL statements to obtain the author's userid, so that we can know the author's space address.

 {dede:arclist row=5}
<a href="/member/index.php?uid=[field:mid runphp=&#39;yes&#39;]global $dsql;
$sql=&#39;SELECT userid FROM dede_member WHERE mid=&#39;.@me;
$spaceurl = $dsql->GetOne($sql);@me=$spaceurl[&#39;userid&#39;];
[/field:mid]" target="_blank">[field:writer/]</a></span>
 {/dede:arclist}
Copy after login

The above example can get the author names and author space addresses of the latest five articles.

Through the above example, we can use it more flexibly.

The above is the detailed content of How to nest sql statements in runphp=yes. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!