Version: 3.5
Have you bridged eFiction, if so with what?: No
Version of PHP:
Version of MySQL:
Have you searched for your problem: Yes
If so, what terms did you try: I tried copying and pasting the error into google
State the nature of your problem:
A fatal MySQL error was encountered.
Query: SELECT PENNAMEFIELD AS penname FROM DBPREFIXfanfiction_coauthors AS c WHERE sid = '3' LEFT JOIN fanfiction_authors as author AS a ON a.UIDFIELD = c.uid
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 'LEFT JOIN fanfiction_authors as author AS a ON a.UIDFIELD = c.uid' at line 1
I have no idea what this means, can somebody please explain? This happens everytime I try and add a story. I installed efiction today
Doing a search will reveal the many threads about this issue. One of such is here: https://efiction.org/forums/index.php?topic=6674
To summarize:
Open stories.php.
Replace .PENNAMEFIELD. with ._PENNAMEFIELD.
Replace .DBPREFIX. with .TABLEPREFIX.
Replace .UIDFIELD. with ._UIDFIELD.
All the instances appear in four separate lines which are basically identical.
Also, check your database to make sure everything installed properly, especially the coauthors table. The structure of how things should be is in docs/tables.sql and in the install file.
If that doesn't fully work, you could replace the 3.5 stories.php with that from the 3.4.3 download, available here: https://efiction.org/downloads/eFiction343.zip. However, you should try the search and replace first, because 1) it's not really a good idea to use a file from an older version for security reasons and 2) it has been shown to create other, though possibly less serious, problems, especially with coauthors.
I have replaced all those lines, and I still have the same problem, except as:
'A fatal MySQL error was encountered.
Query: SELECT author.penname AS penname FROM DBPREFIXfanfiction_coauthors AS c WHERE sid = '4' LEFT JOIN fanfiction_authors as author AS a ON a.UIDFIELD = c.uid
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 'LEFT JOIN fanfiction_authors as author AS a ON a.UIDFIELD = c.uid' at line 1'
now..
You've still got a DBPREFIX in there. Also, it was suggested to switch around the left join and where, so here's the solution with the other changes as well.
Find lines 295, 309, 713, and 727.
$coQuery = dbquery("SELECT ".PENNAMEFIELD." AS penname FROM ".DBPREFIX."fanfiction_coauthors AS c WHERE sid = '$sid' LEFT JOIN "._AUTHORTABLE." AS a ON a.".UIDFIELD." = c.uid");
Replace with:
$coQuery = dbquery("SELECT "._PENNAMEFIELD." AS penname FROM ".TABLEPREFIX."fanfiction_coauthors AS c LEFT JOIN "._AUTHORTABLE." ON "._UIDFIELD." = c.uid WHERE sid = '$sid'");
Would it be easier just to define those variables in queries.php? I don't have the info in front of me but if you added some lines to the end like this
define (PENNAMEFIELD, _PENNAMEFIELD);
It would be duplicating the effort, but it may work.