User:Emanuele/smctemplate test: Difference between revisions From Online Manual

Jump to: navigation, search
No edit summary
No edit summary
Line 1: Line 1:
{{:User:Emanuele/smctemplate
{{smcfunc
|function=db_query
|function=db_query
|usage=$smcFunc['db_query'] (identifier, query, values, connection)
|usage=$smcFunc['db_query'] (identifier, query, values, connection)
|description=Works Similar to how db_query worked in 1.x versions
|description=Works similar to how db_query worked in 1.x versions
|parameters=
|parameters=
{{parmdesc|identifier|d1=is used for identifying specific queries that will be handled specially.
{{parmdesc
|query|d2=is the actual query
  |identifier|d1=is used for identifying specific queries that will be handled specially.
|values|d3=array of values...etc. (optional if no values used in the query)
  |query|d2=is the actual query
|connection|d4=database connection (optional)}}
  |values|d3=array of values...etc. (optional if no values used in the query)
  |connection|d4=database connection (optional)
}}
|example=<nowiki></nowiki> $result = $smcFunc['db_query'](''', '
|example=<nowiki></nowiki> $result = $smcFunc['db_query'](''', '
SELECT poster_time
SELECT poster_time

Revision as of 12:52, 16 April 2011

db_query

Usage:

$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)

Return: a query resource or false on error.

Example:

			$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'],
			)
			);




Advertisement: