Home  >  Article  >  CMS Tutorial  >  How to nest sql statements in runphp=yes

How to nest sql statements in runphp=yes

藏色散人
藏色散人Original
2020-01-10 09:21:582575browse

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}

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!

Statement:
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