URL to your eFiction: http://www.libraryofmoria.com/a/
Version of eFiction: 3.5
Have you bridged eFiction, if so with what?: No
Version of PHP: 4.4.7
Version of MySQL: 5.0.51
Have you searched for your problem: Yes
If so, what terms did you try: fatal mysql error, fatal mysql error fanfiction_stories
State the nature of your problem: After my hosting company did a major server upgrade (which included going from MySQL 4.0.27 to 5.0.51) I went to my eFiction site to add a new story and when I hit submit to enter a new story I got this:
A fatal MySQL error was encountered.
Query: INSERT INTO fanfiction_stories (title, summary, storynotes, catid, classes, charid, rid, date, updated, uid, validated, rr, completed, wordcount, featured, coauthors) VALUES ('I’ll Catch You', 'Mulling over his loneliness one night, Viggo receives an unexpected visitor and an admission he’s not quite sure he’s ready to hear.', 'Feedback: I love it!
Beta: Ireth and Getty', '55,2,45', '968,981', '170,172', '1', now(), now(), '1225', '2', '0', '1', '2344', '0', '0')
Error: (1062) Duplicate entry '0' for key 1
Do you have a test account for us? Yes ( http://www.libraryofmoria.com/a/viewuser.php?uid=153).
Hmm, it looks as though it doesn't like one of the fields that is getting a 0 put into it. So, rr, featured, and coauthors. Only featured and rr should actually be keys, though, so it's one of those two. I'd check to make sure that they have the right settings in the database. Both should be the same. Type: char(1) NOT NULL Default=0 Also, neither of those fields should be set to primary or unique keys, which might cause the error. If they are, change them.
I'd also suggest upgrading to 3.5.1, as the version 3.5 has some known bugs.
Use phpmyadmin to look at the stories table. Look at the sid numbers. Are they 0? If so, it probably isn't auto incrementing correctly. The auto increment parameter may not have been transfered with the upgrade. If that's the case, you'll need to use phpmyadmin to edit the sid field in the stories table to be auto_increment. And if that's the case you'll also want to check the *id fields in the other tables as well.
series -> seriesid
challenges -> chalid
reviews -> reviewid
authors -> uid
chapters -> chapid (not sid!)
There may be others. They all need auto_increment turned on.
Thanks, Lindsay and Tammy, and apologies for the late reply - I've had some health issues...
Changing the sid to auto_increment did the trick - thanks!!
