Advanced search  

News:

CPG Release 1.6.26
Correct PHP8.2 issues with user and language managers.
Additional fixes for PHP 8.2
Correct PHP8 error with SMF 2.0 bridge.
Correct IPTC supplimental category parsing.
Download and info HERE

Pages: [1]   Go Down

Author Topic: Importing sql file - duplicate entry error  (Read 3276 times)

0 Members and 1 Guest are viewing this topic.

lolainslacks

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 33
Importing sql file - duplicate entry error
« on: August 28, 2010, 12:33:51 am »

Hello,

I'm trying to change my albums permissions from "2" (registered users only) to "0" (public for everyone) all at once, so I exported the .sql file, changed all "2"'s to "1"'s, saved and then when I go to phpmyadmin to import the file, I get this error:

Quote
Error

SQL query:

-- -- Dumping data for table `cpg_albums` -- INSERT INTO `cpg_albums` (`aid`, `title`, `description`, `visibility`, `uploads`, `comments`, `votes`, `pos`, `category`, `owner`, `thumb`, `keyword`, `alb_password`, `alb_password_hint`, `moderator_group`, `alb_hits`) VALUES (1, 'Posters', '', 0, 'NO', 'YES', 'YES', 100, 7, 1, 5, '', '', '', 0, 5), (217, 'Promotional Stills', '', 0, 'NO', 'YES', 'YES', 101, 26, 1, 31259, '', '', '', 0, 25), (4, 'Posters', '', 0, 'NO', 'YES', 'YES', 100, 8, 1, 570, '', '', '', 0, 4), (215, 'May 17, 2004', 'Venue: Brooklyn\r\nLocation: New York City, New York, USA', 0, 'NO', 'YES', 'YES', 4, 33, 1, 6334, '', '', '', 0, 5), (6, 'Screen Captures', '', 0, 'NO', 'YES', 'YES', 102, 8, 1, 694, '', '', '', 0, 17), (7, 'Posters', '', 0, 'NO', 'YES', 'YES', 100, 9, 1, 706, '', '', '', 0, 5), (216, 'August 6, 2004', 'Location: New York City, New York, USA', 0, 'NO', 'YES', 'YES', 5, 33, 1, 6189, '', '', '', 0, 8), (9, 'Screen Captu[...]

MySQL said: Documentation
#1062 - Duplicate entry '1' for key 1

I have over 1,000 albums so I don't want to change the permissions one by one. What do I do to fix this error?

Thanks in advance!
Logged

Nibbler

  • Guest
Re: Importing sql file - duplicate entry error
« Reply #1 on: August 28, 2010, 12:41:18 am »

You need to empty the table before you import the file. Better yet, just change them all with a db query

Code: [Select]
UPDATE cpg_albums SET visibility = 0 WHERE visibility = 2
Logged

lolainslacks

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 33
Re: Importing sql file - duplicate entry error
« Reply #2 on: August 28, 2010, 12:46:08 am »

Where do I go? To "Query" and then paste "UPDATE cpg_albums SET visibility = 0 WHERE visibility = 2" in the big empty field at the bottom?
Logged

Nibbler

  • Guest
Re: Importing sql file - duplicate entry error
« Reply #3 on: August 28, 2010, 12:48:47 am »

Yes. Make a backup if you're not sure what you're doing.
Logged

lolainslacks

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 33
Re: Importing sql file - duplicate entry error
« Reply #4 on: August 28, 2010, 12:53:33 am »

Did that and got this:

Quote
0 row(s) affected. ( Query took 0.0017 sec )
Logged

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15764
Re: Importing sql file - duplicate entry error
« Reply #5 on: September 02, 2010, 02:45:44 pm »

What exactly have you done? If you already emptied your table or
changed all "2"'s to "1"'s
it's no wonder that the query affects 0 rows.
Logged
Pages: [1]   Go Up
 

Page created in 0.022 seconds with 20 queries.