User:Emanuele/sandbox/smcFunc From Online Manual

< User:Emanuele
Revision as of 08:36, 12 April 2011 by Emanuele (talk | contribs) (Created page with "===db_query=== Current structure: {{code|1=<nowiki> '''Usage''' $smcFunc['db_query'] (identifier, query, values, connection) * Works Similar to how db_query worked in 1.x version...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

db_query

Current structure:


'''Usage''' $smcFunc['db_query'] (identifier, query, values, connection)
* 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' => $user_settings['id_msg_last_visit'],
                )
            );</pre>

Proposed structure:


*'''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=             $result = $smcFunc['db_query'](''', '
                SELECT poster_time
                FROM {db_prefix}messages
                WHERE id_msg = {int:id_msg}
                LIMIT 1',
                array(
                    'id_msg' => $user_settings['id_msg_last_visit'],
                )
            );
}}
*'''Return''' - a query resource or '''false''' on error.

or the same without list (except for parameters, that should always be a list)


Attempting a template:




{{#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= {{{example}}}}}|}}<!--
-->{{#if: {{{return|}}}|<p>'''Return''':</p>{{{return}}}|}}<!--

-->|'''Template must be given a tag}}
<noinclude>{{documentation}}</noinclude>





Advertisement: