(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...") |
No edit summary |
||
Line 20: | Line 20: | ||
Proposed structure: | Proposed structure: | ||
{{code|1=<nowiki> | {{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= $result = $smcFunc['db_query'](''', ' | |||
SELECT poster_time | SELECT poster_time | ||
FROM {db_prefix}messages | FROM {db_prefix}messages | ||
Line 37: | Line 37: | ||
); | ); | ||
}} | }} | ||
'''Return''' - a query resource or '''false''' on error. | |||
</nowiki>}} | </nowiki>}} | ||
Revision as of 08:37, 12 April 2011
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.
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>