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='yes']global $dsql; $sql='SELECT userid FROM dede_member WHERE mid='.@me; $spaceurl = $dsql->GetOne($sql);@me=$spaceurl['userid']; [/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!