first, some back ground info.
I did not do the original installation. i took over this archive about a year ago and noticed the Challenge mod wasn't on. I tried adding it now after the upgrade (which went easy, no problems) but the Modules link doesnt even show up in the Admin panel.
I tried another way, typing the direct link to the challenges/install.php and I got this error:
A fatal MySQL error was encountered.
Query: INSERT INTO settingsfanfiction_modules(`name`, `version`) VALUES('Challenges', '1.4')
Error: (1054) Unknown column 'name' in 'field list'
Do i need to do something in the database? Add a table or something? lol! please help.... thanks! π
You're missing something in your database, but I'm not sure what. Use phpmyadmin to check the settingsfanfction_modules table.
Ok i have the table... that's a good sign.
but it's empty and it says "No index defined!"
there is a field for challenges though, but yeah - empty.
I can add everything manually right? How do I go about doing that?
thanks for the help π
If ever you want to check what a eFic-standard table is meant to look like, a good place to check is the install/install.php file.
CREATE TABLE `".$tableprefix."fanfiction_modules` (
`id` int(11) NOT NULL auto_increment,
`name` varchar(100) NOT NULL default 'Test Module',
`version` varchar(10) NOT NULL default '1.0',
PRIMARY KEY (`id`),
KEY `name_version` (`name`,`version`)
The last two lines tell you what to add as primary key and key (you must not have them assigned, hence the missing index warning. This happened on a couple of my tables for no reason when they were first created so it's not totally unheard of). To find out what the challenges module is meant to add to the table check in modules/challenges/install.php.
dbquery("INSERT INTO ".TABLEPREFIX."fanfiction_modules(`name`, `version`) VALUES('$moduleName', '$moduleVersion')");
The variables must be assigned somewhere else, but I think it wouldn't be too hard to figure out what it's really meant to be for manual entry.
ETA: Yes, that was right. For the module distributed with 3.5.1, I get the following from modules/challenges/version.php.
$moduleVersion = "1.4";
$moduleName = "Challenges";
ok. ummm.... thanks but can you break it down for me?
I've never done anything manual when it comes to mysql and just looking at the code, then the database, I'm not sure where what goes where π³
Okay.
This is what you need to know to create the table, and to verify that everything is right with it.
CREATE TABLE `".$tableprefix."fanfiction_modules` (
`id` int(11) NOT NULL auto_increment,
`name` varchar(100) NOT NULL default 'Test Module',
`version` varchar(10) NOT NULL default '1.0',
PRIMARY KEY (`id`),
KEY `name_version` (`name`,`version`)
Line 1: the name of the table, which you say you already have created.
Lines 2-3: the names of the fields are the first thing (id, name, version)
Next they specify what type of field to have.
Then they say null or not null (whether or not something HAS to be in the field)
The id field specifies to auto-increment, in other words always add one to keep the id numbers unique
The name and version fields have default content (Test Module, 1.0), although i think you could probably leave this blank
The last two lines:
Keys are important in databasing because they describe how the database should work & relate to other parts within it or other databases. For instance, there is a type of key called a unique key, which obviously means that any field attributed with that key would need to have each of its entries be unique. I think Primary Keys are also unique(?). Anyway, there's a tool in PHPMyAdmin for creating keys, or you could create a query. (I think the tool might balk at adding two field to the same key, with the name_version one there.)
The other lines I quoted just say to put "Challenges" as the name and "1.4" as the version in the field, without the quotes, of course. The id field autoincrements and will assign an id number without you doing anything.
thanks so much, you made it make sense lol!
I used the challenges/install.php as a guide to continue the manual installation. I was so proud that I got it to work, I tested it and added a challenge! yay!
buuuuut when I went to respond to the challenge, I got this error:
A fatal MySQL error was encountered.
Query: SELECT count(distinct uid) FROM settingsfanfiction_authorprefs WHERE stories > 0 )
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 ')' at line 1
could you please help me fix this one too? thanks so much again
That's probably a "normal" error and not related to install. I haven't ever really used the challenges module so I really couldn't say. I know I've seen fatal errors crop up with it several times so you might look through the general help board or do a search, and I bet you'll find something like it.
oops! you're right.... my bad.
i didnt want to "double post" or anything lol!
and thanks again for the help π
Make sure you've got the challenges module files uploaded fully. It seems like there's an out of date file in there somewhere.
thanks Tammy!
edit! I feel like a dumbass lol! i read this post https://efiction.org/forums/index.php?topic=7161.0 and realized the challlenges.php was on the list so i download that one and PRESTO ... problem fixed.
again thank you both sooo much π
