my mysql code:
Code
INSERT INTO `table` (Username)
SELECT 'name' FROM `table`
WHERE NOT EXISTS (SELECT * FROM `table`
WHERE Username = 'name')
LIMIT 1
Quote
db_insert
Usage $smcFunc['db_insert'] (method, table, columns, data, keys, disable_trans, connection)
Method tells how to change the data. Accepts "replace" "ignore" or "insert".
i thought about using replace - however i don't need to replace data. i just need to check if it exists, and if it does then skip it.
so my question is if it's possible to conditionally insert data into mysql using the smf function db_insert, how would i go about doing it?e.g.
Code
}elseif($mode == "insert"){
$smcFunc['db_insert']('insert', 'table',
array('Username' => 'string'),
array($account),
array());
,
This post was edited by Targe on Aug 31 2012 05:01am