visitors can't uplo...
 
Notifications
Clear all

visitors can't upload - mysql error (SOLVED)

11 Posts
3 Users
0 Reactions
1,774 Views
 lipa
(@lipa)
Posts: 48
Eminent Member
Topic starter
 

URL to your eFiction: http://tokiohotelfictionpt.com
Version of eFiction: 3.5.1

Version of PHP: can be found out from your host - PHP version 5.2.5
Version of MySQL: can be found out from your host - MySQL version 4
Have you searched for your problem: yes

State the nature of your problem: visitors can't upload even if I can
( test  account)
nick:test
pass: test1

I think I messed up something in mysql,in fanfiction_stories, trying to resolve the rating problem from the other topics.

I can upload stories perfectly, but to my visitors, theres this error:

Ocorreu um erro no MySQL.
Query: INSERT INTO fanfiction_stories (title, summary, storynotes, catid, classes, charid, rid, date, updated, uid, validated, rr, completed, wordcount, featured, coauthors) VALUES ('novo album', 'AAAAAAAAAAAAAAAAAAAAAH', '', '8', '101,45,46,29,31,1,3', '3,4', '1', now(), now(), '5', '0', '0', '1', '616', '0', '0')
Error: (1062) Duplicate entry '0' for key 'rating'

I'm a newbie to php and mysql, so I really don't understand what the error is trying to say


 
Posted : 20/06/2009 8:38 pm
(@lyndsie)
Posts: 1263
Member Moderator
 

That message is saying that you're having a problem because of the rating selected. Looks there like you've got none selected. It's probably related to your other issue. I'll go back and look at that again.


 
Posted : 20/06/2009 11:36 pm
 lipa
(@lipa)
Posts: 48
Eminent Member
Topic starter
 

Thanks for your quick answer. Just in case it can help, these are the screen from my fanfiction_stories


 
Posted : 21/06/2009 1:44 pm
(@lyndsie)
Posts: 1263
Member Moderator
 

It looks like your keys are all messed up; especially look at those warnings like displayed in the second shot. According to install/install.php, this is what it should be for that table:


PRIMARY KEY  (`sid`),
  KEY `title` (`title`),
  KEY `catid` (`catid`),
  KEY `charid` (`charid`),
  KEY `rid` (`rid`),
  KEY `uid` (`uid`),
  KEY `featured` (`featured`),
  KEY `completed` (`completed`),
  KEY `rr` (`rr`),
  KEY `validateduid` (`validated`,`uid`),
  KEY `recent` (`updated`,`validated`)

You should delete all those ratings_2, ratings_3, etc. and make sure everything else matches what I pasted up there. You might check other tables as well. Scrolling through the install file will give you the most up-to-date database configurations.


 
Posted : 21/06/2009 9:25 pm
 lipa
(@lipa)
Posts: 48
Eminent Member
Topic starter
 

Thanks for the tip ^^
I think my host is down, I can't either enter mysql manager or the site itself, damn

I know how to delete the rating_* but could you tell me where I make sure my table on mysql is setted like you quoted? at least in the screen I showed I don't see where the information you gave matches...It's a code I can see somewhere or I have to edit each line?

edited: reading my post again I realize that I don't really understand nothing about mysql, i already promised myself I will get one of the extensive tutorials and read it  πŸ˜†


 
Posted : 21/06/2009 10:00 pm
(@lyndsie)
Posts: 1263
Member Moderator
 

A general overview of MySQL couldn't hurt. The Sun MySQL docs are here: http://dev.mysql.com/doc/ (Although this is a little dense and not very good for beginners.) Basically what the problem is is that you've got multiple index keys and a unique key all set to the 'rating' field. Keys are a part of a MySQL database that are assigned within each table and manage how tables can be updated and used. Their function varies by type. For example, a unique key, which is the second line of your list of keys, means that every entry in that field has to be unique. So, this explains partly why you're getting that message. There are a finite number of possible answers to the question, "What is the ID number for the rating selected?" They don't increment. If you have four different ratings, then you'll have only the numbers 1-4 as possible choices. Also, there shouldn't even be a key of any kind with 'rating' at all, unless you've got some kind of mod or block installed that put it in there. (I know the challenges module installs a 'challenges' key, for example.)

Also, you've got the extra entries in there, also with the field rating, so it's not liking that either. The messages appearing underneath the box with the keys in your screenshot say exactly what the problem is. You should check your other tables for messages like that.

To fix it is very simple (once you have access, anyway). Looking at that list I pasted in my previous post, delete 'rating_2', 'rating_3' and 'rating_4' by clicking the red x's. If you don't have any additional modules or blocks installed than the standard install, then also delete the unique key 'rating', although I don't think it's a valid one either, since I think it being set as unique is wrong and it would need to be set as index instead.

That should be it.


 
Posted : 22/06/2009 12:20 am
 lipa
(@lipa)
Posts: 48
Eminent Member
Topic starter
 

Thanks for the whole explanation πŸ™‚ the host is working now

I already eliminated the ratings_* and checked for the rest of mysql for warnigs, I found the some type on fanfiction_messages and did the same.

There's one more though, that I don't understand if it's normal or not, I don't see two chapid with "index", only one,here's the screen

edited:even after deleting the ratings, it keeps giving me the same error again :/


 
Posted : 22/06/2009 6:55 am
(@lyndsie)
Posts: 1263
Member Moderator
 

So did you delete the key with the name 'rating' (and not just the duplicates) from fanfiction_stories? I think that's the one that's causing the message. I think it's an invalid key and it's set to UNIQUE, so you could only ever use each of your ratings once before you have problems. (Again, still unsure why it's apparently trying to insert 0 and mean to go back to your other post.)

Here's the setup for fanfiction_reviews:


PRIMARY KEY  (`reviewid`),
  KEY `chapid` (`chapid`),
  KEY `rating` (`rating`),
  KEY `respond` (`respond`),
  KEY `avgrating` (`type`,`item`,`rating`),
  KEY `bychapter` (`chapid`,`rating`),
  KEY `byuid` (`uid`,`item`,`type`)

To find the duplicates you should look in the 'field (campo)' column, not the name column. There are two chapid's in the field column, but that's how it's meant to be according to the script - in the one named chapid and in the one named bychapter. Double-checking, the indexes on that table look fine.


 
Posted : 22/06/2009 2:16 pm
 lipa
(@lipa)
Posts: 48
Eminent Member
Topic starter
 

IT'S WORKING NOW!!

I didn't delete the ratings, I thought it was the only one it was supposed to be there. You can't imagine how thankfull I am, I found it amazing that you really try to explain it and not just say "do like this and that" it's great to know there's still great people out there

thank again!


 
Posted : 22/06/2009 3:58 pm
(@lyndsie)
Posts: 1263
Member Moderator
 

Sweet. Glad it's solved. You should edit the first post with [solved] in the title so that everyone knows. : )


 
Posted : 22/06/2009 4:51 pm
(@tammy)
Posts: 2577
Member Moderator
 

It was the unique key.  By setting it as unique you set it so each rating could only be associated with one story.


 
Posted : 22/06/2009 11:20 pm
Share: