No edit summary |
m (refresh SMW properties) |
||
Line 24: | Line 24: | ||
);</nowiki> | );</nowiki> | ||
}} | }} | ||
<noinclude> | <noinclude> | ||
[[Category:Database Functions]]</noinclude> | [[Category:Database Functions]]</noinclude> |
Latest revision as of 16:39, 11 October 2012
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') );