Fatal Error with Fa...
 
Notifications
Clear all

Fatal Error with Favorite Author

9 Posts
3 Users
0 Reactions
1,896 Views
(@talullah)
Posts: 65
Trusted Member
Topic starter
 

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: 4.0.27
Have you searched for your problem: Yes
If so, what terms did you try: Query: INSERT INTO fanfiction_favorites(uid, item, type, comments)
State the nature of your problem: When someone tries to add an author to their favorites, they get the following error

A fatal MySQL error was encountered.
Query: INSERT INTO fanfiction_favorites(uid, item, type, comments) VALUES ('1', '1096', 'AU', 'test') ON DUPLICATE KEY UPDATE comments = 'test'

Error: (1064) You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'ON DUPLICATE KEY UPDATE comments = 'test'' at line 1

I saw a similar question here and I tried to manually find the duplicates in the favorites table but I didn't succeed... I'd like to find a way to fix this problem without losing the information that is already in the table.

Suggestions?

Do you have a test account for us? Yes, the 'test' account that eFiction creates ( http://www.libraryofmoria.com/a/viewuser.php?uid=153).

Thanks!


 
Posted : 27/01/2009 8:03 am
(@lyndsie)
Posts: 1263
Member Moderator
 

eFiction doesn't create a test account by default.  We'd still need the password.

Hmm... but that error.  Check the indexes for the fanfiction_favorites table?

Incidentally, that's line 50 of user/favau.php.


 
Posted : 27/01/2009 11:35 am
(@talullah)
Posts: 65
Trusted Member
Topic starter
 

Hi,

Thanks for replying.

I went through the fanfiction_favorites table again but I really couldn't find a duplicate. There aren't many entries and I've searched the table by uid and by item twice...

When you say "Incidentally, that's line 50 of user/favau.php"... I went to the file and saw the code but I'm not sure if you meant I should do something to it and if so what.

After this post I tried uploading the user/favau.php file again but that didn't work out. Any ideas on what I should do next?

About the account, I was under that impression since I didn't created myself and it has the eFiction email addie associated to it. I guess at some point one of the mods created it. I'd rather not change the password and send it, so if you really need it, I'd appreciate if you could retrieve it through the email account.

Thanks.


 
Posted : 29/01/2009 6:55 pm
(@lyndsie)
Posts: 1263
Member Moderator
 

I was just telling you the line so you knew where to look.  Not sure what you should do.

The error's pointing to the 'on duplicate key' part.  Here's a better explanation than I could give: If you specify ON DUPLICATE KEY UPDATE, and a row is inserted that would cause a duplicate value in a UNIQUE index or PRIMARY KEY, an UPDATE of the old row is performed. (From here.)

So what I suggested is to verify that your indexes are correct.  For fanfiction_favorites they should be the following:
  UNIQUE KEY `byitem` (`item`,`type`,`uid`),
  UNIQUE KEY `byuid` (`uid`,`type`,`item`)

It might also have something to do with your version of MySQL.

OH, and, we can't use the lost password feature.  At least I can't, since I have no idea who made the account and I don't have access to whatever email address they use, so there's no way for me to retrieve the password.


 
Posted : 29/01/2009 7:22 pm
(@lyndsie)
Posts: 1263
Member Moderator
 

Sorry for the double-posting, just wanted to make it clear this was a new topic.

I found some references that say that ON DUPLICATE KEY UPDATE was added in MySQL 4.1.0.  You've got an earlier version.  The best solution all around would be to see if your host will upgrade to a newer version, but barring that, try replacing line 50 of user/favau.php with.


$result = dbquery("REPLACE INTO ".TABLEPREFIX."fanfiction_favorites(uid, item, type, comments) VALUES ('".USERUID."', '$a', 'AU', '$comment')");

Not sure about dbquery vs mysql_query for your version, one of the reasons why you should prod your host to update.

Source


 
Posted : 29/01/2009 7:36 pm
(@talullah)
Posts: 65
Trusted Member
Topic starter
 

Hi,

I tried upgrading to PHP 5 but that didn't do the trick.

Replacing line 50 with the code you gave me, however, worked perfectly.

Thanks for your help. πŸ™‚

Tal


 
Posted : 30/01/2009 6:23 am
 Elle
(@jenny)
Posts: 594
Honorable Member
 

Not sure about dbquery vs mysql_query for your version, one of the reasons why you should prod your host to update.

dbquery() is a custom version of mysql_query() (or mysqli_query()). I think its purpose be for debugging.


archive: dramione.org
site: accio.nu

Available for skin/mod commission! πŸ™‚

 
Posted : 30/01/2009 11:38 am
(@lyndsie)
Posts: 1263
Member Moderator
 

I had trouble with dbquery () when we were at a previous version of MySQL, but I think it was only in the RSS feed, so it might have been a special situation.  Replacing it was mysql_query() fixed it and I think I remember reading dbquery() had been added later?  *memory is sketchy*

Anyway, to the OP, glad I could help!  Just wanted to let you know that upgrading your PHP version wouldn't help, it's the MySQL version that's the problem.  You'd need 4.1.0 or higher, for this at least.  It's possible you might run into other issues so it might require a higher version.  I think the latest release is 5.1.


 
Posted : 30/01/2009 11:50 am
(@talullah)
Posts: 65
Trusted Member
Topic starter
 

Gotcha! I talked to my providers about the MySQL upgrading but they want me to make a new plan and transfer everything so for now I'll avoid the complication and keep my fingers crossed. πŸ˜‰

Thanks!


 
Posted : 30/01/2009 4:30 pm
Share: