Official Introduction to {dede: SQL}
Tag name: SQL function description: used to obtain the returned content from an SQL query in the template. Applicability: use the global basic syntax: {dede: SQL = ""} underlying Template {/dede: SQL} parameter description: SQL = "" complete SQL query statement underlying template field: all fields found in SQL statements can be called using [field: field name/].
Application instance:
1. Call the content of an article published by a specific member.
| The code is as follows: |
Copy code |
{Dede: SQL = 'select * from dede_archives where mid = 1 '} <A href = '/plus/view. php? Aid = [field: id/] 'target = '_ blank'> [field: title/] </a> {/Dede: SQL} |
If mid is the user ID, see
Dede_archives data table fields in secondary development
Example
| The code is as follows: |
Copy code |
{Dede: SQL = 'SELECT d. typename, d. id, count (da. id) as heji from dede_arctype d left join dede_archives da on da. typeid = d. id where d. reid = 0 group by d. typename order by heji desc limit 0, 8 ;'} <Li> [[field: heji/] [field: typename/] a total of articles delivered </li> {/Dede: SQL} |
An instance of my application calls a record
| The code is as follows: |
Copy code |
{Dede: SQL = 'select * from rschina_myad where aid = 24 '} <Li class = "tab1"> <a href = "#1"> <span> [field: adname/] </span> </a> </li> {/Dede: SQL} {Dede: SQL = 'select * from rschina_myad where aid = 25 '} <Li class = "tab2"> <a href = "#2"> <span> [field: adname/] </span> </a> </li> {/Dede: SQL} {Dede: SQL = 'select * from rschina_myad where aid = 26 '} <Li class = "tab3"> <a href = "#3"> <span> [field: adname/] </span> </a> </li> {/Dede: SQL} {Dede: SQL = 'select * from rschina_myad where aid = 27 '} <Li class = "tab4"> <a href = "#4"> <span> [field: adname/] </span> </a> </li> {/Dede: SQL} {Dede: SQL = 'select * from rschina_myad where aid = 28 '} <Li class = "tab5"> <a href = "#5"> <span> [field: adname/] </span> </a> </li> {/Dede: SQL} |