I tried searching but could not find the information I need.
I'm just wondering what is the best way of replacing a number of records at one time with the smcFunc 'replace' function.
So say I have a load of database records and then I have an array that contains what I want to change those records to.
Is the 'replace' method limited to handling one query at a time meaning I would need to loop through the array holding the new data and do it piecemeal ?
Or somehow can I just incorporate my array of new values into the smcFunc call ?
Thanks for any hints :)
For example, how would I emulate this basic MYSQL query as a starter :
INSERT INTO tbl_name (a,b,c) VALUES(1,2,3),(4,5,6),(7,8,9);
Never-mind, I figured it out with some experimenting. For anyone else you can do this :
$query = $smcFunc['db_insert']('replace', "
{db_prefix}my_table",
array(
'id' => 'int',
'value' => 'string',
),
array(
array(24,'stringone'),
array(28,'stringtwo'),
array(30,'someotherstring'),
),
array('id'));
http://wiki.simplemachines.org/smf/$smcFunc
http://wiki.simplemachines.org/smf/Db_insert
:P