I have a table that i store userinfo. Each user has a unique userid, but the rest of their information varies.
When i try to run a statement to UPDATE that table, where userid = $userid, i get a Duplicate entry 'XXX' for key 'userid'
where XXX is their userid.
I have the userid field set as unique, but obviously ive done something wrong somewhere.
Here is my statement
UPDATE `users` SET `screenname` = '$screenname' ,`real_name` = '$real_name' ,`profimg` = '$profimg' WHERE `userid` = '$userid'
Table Structure
CREATE TABLE `users` (
`userid` int(11) NOT NULL,
`screenname` text COLLATE utf8_unicode_ci NOT NULL,
`real_name` text COLLATE utf8_unicode_ci NOT NULL,
`profimg` text COLLATE utf8_unicode_ci NOT NULL,
UNIQUE KEY `userid` (`userid`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;