Errors: array and i...
 
Notifications
Clear all

Errors: array and invalid arguement? in storyblock.php

14 Posts
3 Users
0 Reactions
2,240 Views
(@vikki)
Posts: 38
Eminent Member
Topic starter
 

URL to your eFiction: http://www.nsync-fiction.com/index.php
Version of eFiction: 3.5.1
Have you bridged eFiction, if so with what?: nope
Version of PHP: 5.2.4
Version of MySQL: 5.1.30
Have you searched for your problem: yes
If so, what terms did you try: storyblock
State the nature of your problem:

this error code pops up on various pages (tags.php, challenges.php, viewstory.php) every now and then ever since I upgraded eFiction and added a few mods (story end, recommendations, display to word, tracker)

Warning: array_keys() [function.array-keys]: The first argument should be an array in /home/nsync908/public_html/nsyncfiction/includes/storyblock.php on line 89

Warning: implode() [function.implode]: Invalid arguments passed in /home/nsync908/public_html/nsyncfiction/includes/storyblock.php on line 89

and I checked out line 89 of my includes/storyblock.php file and this is it:

$tpl->assign("addtofaves", "[<a href="""._BASEDIR."user.php?action=favst&amp;add=1&amp;sid=".$stories['sid'"]."">"._ADDSTORY2FAVES."</a>] [<a href="""._BASEDIR."user.php?action=favau&amp;add=".$stories['uid'"].(count($stories['coauthors']) ? ",".implode(",", array_keys($stories['coauthors'])) : "")."">"._ADDAUTHOR2FAVES."</a>]");

does this mean something is wrong with a tpl file?  πŸ˜•

can someone please help fix this? thanks


 
Posted : 31/10/2009 12:20 am
(@tammy)
Posts: 2577
Member Moderator
 

Something is wrong with the coauthors of that particular story. 


 
Posted : 31/10/2009 5:24 pm
(@vikki)
Posts: 38
Eminent Member
Topic starter
 

but it even shows up on non-story pages.... like admin.php  😐

could there be something wrong with my tables?


 
Posted : 02/11/2009 3:28 pm
(@tammy)
Posts: 2577
Member Moderator
 

It can't be the exact same error.  Are you sure you got all your files updated?  I would upload the files again.  You may have missed some.


 
Posted : 02/11/2009 4:12 pm
(@vikki)
Posts: 38
Eminent Member
Topic starter
 

ok i think i narrowed in on the problem...

the reason i saw the error sometimes on different pages was because of the Random Story block I have going on the bottom of the page.

I think the problem is my coauthors table. Is that something new with the latest version of eFiction? I know the archive has had a couple stories with coauthors but when I checked the table there was only one row.

I think the script is looking for the coauthor information and isnt finding it. I know there's a field for it in the stories table... did this change and maybe when I upgraded (last week) it didnt transfer?

I'm sorry if this is all confusing, I'm confused too! lol! I didnt do the initial install of eFiction for this archive so I'm not sure what was (or wasn't) done in the beginning.

thanks again for any help!


 
Posted : 04/11/2009 8:30 pm
(@tammy)
Posts: 2577
Member Moderator
 

Define "new"?  There was a change in how coauthors were stored back in 3.3 I believe.  Nothing even remotely recent.


 
Posted : 04/11/2009 9:31 pm
(@vikki)
Posts: 38
Eminent Member
Topic starter
 

oh... well it just created the coauthors table when I updated it.

but I see that all the coauthors information is still saved in the stories table and not in the coauthors.... is there a way I can transfer it now? besides creating the rows one by one?


 
Posted : 04/11/2009 10:07 pm
(@lyndsie)
Posts: 1263
Member Moderator
 

There should be a coauthors field in fanfiction_stories. It should read either 1 (has coauthors) or 0 (no coauthors). I did find that after an upgrade, that field sometimes read blank when it should have 0. (The lastest install scripts say it should be not null, so it's definitely supposed to have the 0 or 1; if you've got blank ones I'd put 0.) This tells the script to look in fanfiction_coauthors to see who the coauthors are.

So, if you've only got one story that has a coauthor, then you should also only have one line in the coauthors field in fanfiction_stories that has 1 as the entry. Make sense?

I think coauthors is a little buggy. When a coauthor was removed (which happened every time a story was edited unless the coauthor was put back), not all the database stuff got changed properly. That could account for the issues you're having.


 
Posted : 04/11/2009 10:17 pm
(@vikki)
Posts: 38
Eminent Member
Topic starter
 

There should be a coauthors field in fanfiction_stories. It should read either 1 (has coauthors) or 0 (no coauthors).

the coauthors field in my stories table reads the uid of the coauthor .... which is why I think the upgrade missed a huge step somewhere.  😐

I just hope there's a way I can fix this.


 
Posted : 04/11/2009 11:18 pm
(@tammy)
Posts: 2577
Member Moderator
 

So you have a coauthors table but it's empty?  Or you don't have a coauthors table at all?

If you don't have a coauthor's table, you can probably use phpmyadmin to set your version back to 3.4 and then run update.php again.


 
Posted : 04/11/2009 11:53 pm
(@vikki)
Posts: 38
Eminent Member
Topic starter
 

no i do have a coauthors table... but its empty. I think when I upgraded it created it... because I'm sure it wasnt there before.

I just don't know what to do next. How can I transfer the coauthors info into the coauthors table? and now edit the stories table to say 1 or 0 instead of the uid of the coauthor?  πŸ˜•


 
Posted : 05/11/2009 12:07 am
(@lyndsie)
Posts: 1263
Member Moderator
 

If it's still got the uids in the coauthors field in fanfiction_stories, you can probably just make a list of the sids with the associated ids in the coauthor field there, and then that's basically the data you need to put into fanfiction_coauthors. There are only two fields there: the sid of the story and the uid of the coauthor in question. If the story has more than one coauthor, then there could be more than one entry with the same sid (but different uids).

So say you have story with an sid of 73, and the coauthor field in fanfiction stories reads 986. Make a new row in fanfiction_coauthors where sid is 73 and uid is 986. Then change the fanfiction_stories.coauthor where sid=73 to 1. And so on. Hopefully you don't have too many coauthors.


 
Posted : 05/11/2009 1:08 am
(@vikki)
Posts: 38
Eminent Member
Topic starter
 

ok there was only 18 coauthors *whew* lol!

thanks so much for your help! the error messages are now gone  πŸ˜€


 
Posted : 05/11/2009 2:28 am
(@tammy)
Posts: 2577
Member Moderator
 

Okay anyone following this thread later, what I was going to suggest is delete the coauthors table and then use php to set the version back to 3.4 and run the update again, but this works too.


 
Posted : 05/11/2009 10:12 am
Share: