db_insert From Online Manual

Revision as of 16:39, 11 October 2012 by AngelinaBelle (talk | contribs) (refresh SMW properties)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Usage:

$smcFunc['db_insert'] (method, table, columns, data, keys, disable_trans, connection)


Description: Insert data into the database.

Parameters:

  • method tells how to change the data. Accepts "replace" "ignore" or "insert" (default replace).
  • table the table where the data will be changed on.
  • columns An array ( column_name => input_type) set that holds all column names that will be changed and their expected input type.
  • data holds an array that must be as long as the column array with all the data that will be used.
  • keys is supposed to hold the tables key information, only affect sqlite and postrgresql (when using "replace").
  • disable_trans .
  • connection the database connection.

Example:

$smcFunc['db_insert']($topicinfo['new_from'] == 0 ? 'ignore' : 'replace',
	'{db_prefix}log_topics',
	array(
		'id_member' => 'int', 'id_topic' => 'int', 'id_msg' => 'int',
	),
	array(
		$user_info['id'], $topic, $mark_at_msg,
	),
	array('id_member', 'id_topic')
);



Advertisement: