User:Emanuele/sandbox/smcFunc: Difference between revisions From Online Manual

Jump to: navigation, search
No edit summary
(Updating to match new version of source page)
Line 1: Line 1:
===db_query===
{{parmdesc/sandbox
Current structure:
|sep= -
{{code|1=<nowiki>
|highlight=no
'''Usage''' $smcFunc['db_query'] (identifier, query, values, connection)
|test|d1=a
* Works Similar to how db_query worked in 1.x versions.
* Identifier is used for identifying specific queries that will be handled specially.
* Values is an array of values you are intending to use in the query.
'''Example'''
<pre>            $result = $smcFunc['db_query'](''', '
                SELECT poster_time
                FROM {db_prefix}messages
                WHERE id_msg = {int:id_msg}
                LIMIT 1',
                array(
                    'id_msg' =&gt; $user_settings['id_msg_last_visit'],
                )
            );</pre>
</nowiki>}}
 
Proposed structure:
{{code|1=<nowiki>
'''Usage''' - {{code|1=$smcFunc['db_query'] (identifier, query, values, connection)}}
'''Description''' - Works Similar to how db_query worked in 1.x versions.
'''Parameters''':
*'''identifier''' - is used for identifying specific queries that will be handled specially.
*'''query''' - is the actual query
*'''values''' - array of values...etc. (optional if no values used in the query)
*'''connection''' - database connection (optional)
'''Example''' - {{code|1=&nbsp;           $result = $smcFunc['db_query'](''', '
                SELECT poster_time
                FROM {db_prefix}messages
                WHERE id_msg = {int:id_msg}
                LIMIT 1',
                array(
                    'id_msg' =&gt; $user_settings['id_msg_last_visit'],
                )
            );
}}
'''Return''' - a query resource or '''false''' on error.
</nowiki>}}
 
 
Attempting a template:
{{code|1=<nowiki>
 
 
{{#if: {{{function|}}}|{{#if: {{{wikiheader|}}}|{{
#switch: {{{wikiheader}}}
|1=={{ucfirst:{{{function}}}}}=
|2==={{ucfirst:{{{function}}}}}==
|3===={{ucfirst:{{{function}}}}}===
|4===== {{ucfirst:{{{function}}}}}====
|#default
}}
}}
__NOEDITSECTION__ }}
{{#if: {{{usage|}}}|{{#set:BBC_button=[[File:{{{button}}}]]}}<p>'''button''': [[File:{{{button}}}]]</p>|}}<!--
-->{{
#if: {{{usage|}}}|
<p>
'''Usage''': {{code|1={{{usage}}}}}</p>|}}<!--
-->{{#if: {{{description|}}}|<p>'''Description''':</p>{{{description}}}|}}<!--
-->{{#if: {{{parameters|}}}|<p>'''Parameters''':</p>{{{parameters}}}|}}<!--
-->{{#if: {{{example|}}}|<p>'''Example''':</p>{{code|1=&nbsp;{{{example}}}}}|}}<!--
-->{{#if: {{{return|}}}|<p>'''Return''':</p>{{{return}}}|}}<!--
-->|'''Template must be given a tag}}
<noinclude>{{documentation}}</noinclude>


{{code|1=a one-line code snippet}}


</nowiki>}}
{{code|1=<nowiki>a one-line code snippet</nowiki>}}

Revision as of 09:33, 10 July 2011

  • test - a


a one-line code snippet
a one-line code snippet


Advertisement: