https://forum.site-name.org/index.php?action=admin;area=manageboards;sa=board2
Duplicate entry '60-2' for key 'PRIMARY'
Error: Duplicate entry '60-2' for key 'PRIMARY'
Database Error: Duplicate entry '60-2' for key 'PRIMARY'
INSERT INTO smf209_moderators(`id_board`, `id_member`)
VALUES
(60, 2),
(60, 2)
File: /var/www/html/Sources/Subs-Boards.php
Line: 763
call_user_func /index.php:176
AdminMain
ManageBoards Sources/Admin.php:754
EditBoard2 Sources/ManageBoards.php:111
modifyBoard Sources/ManageBoards.php:683
SMF_DB_MySQLi->insert Sources/Subs-Boards.php:763
SMF_DB_MySQLi->query Sources/Subs-Db-mysql.php:1488
SMF_DB_MySQLi->error Sources/Subs-Db-mysql.php:1171
log_error
Sources/Subs-Db-mysql.php:126
Ran it manually in phpmyadmin but i wonder why it heppenned ?
INSERT INTO smf209_moderators
(`id_board`, `id_member`)
VALUES
(60, 2)
SELECT * FROM `smf209_moderators`
Did you try to add the same board moderator twice at the same time?
yes, i was updating a board and those fields get autofilled.
does this code look right to you ?
$smcFunc['db_insert']('insert',
'{db_prefix}moderators',
array('id_board' => 'int', 'id_member' => 'int'),
$inserts,
array('id_board', 'id_member')
);
Yes, but if you try to insert two rows the same, it will fail... which is what the original issue was.
Which implies the $inserts got two values, presumably from you trying to add the same person twice unnecessarily.
yes BUT i added it successfully as i did not see any duplicate.
it couldn't've been if i added it manually.
maybe a DB anomaly.
really.... I know I've told you this before.... you should never, ever, ever, ever edit the database directly
Except, as usual we've gone down irrelevant tangents. You adding it manually in the DB is not relevant.
From the UI it appears you tried to add the same user twice as a moderator causing the error originally shown. It is not surprising that if you dint use the UI and don't try to add the same person twice, you don't get an error... what you've basically said is "I have a flat tyre on my car but if I use my bike, it's fine".
OK guys, I consider myself told off !
it's only a harmless little DB update, how bad can it be ?
(don't answer that)