Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+2 votes
1.6k views
in Plugins by

The page is here: http://pokemondb.net/pokebase/user-activity/questions/barry%27s%231fan

It's using my user activity plugin but the query that's there is not in my code so it must be from one of the Q2A functions.

Actually the error seems to occur before it ever gets to the process_request function - if I return from the function immediately the error still happens.

Q2A version: 1.4
by
Also, is there an option to not show SQL errors on the live site?

1 Answer

0 votes
by

This appears to be happening on a custom page of yours? If so the problem is that # (as well as $ and ^) have special meaning in queries passed to qa_db_query_sub(...) so you should use parameter substitution rather than concatenation to build the query.

by
Actually I am using substitution in all my queries (unless I am mistaken - can you take a quick look at the code on https://github.com/svivian/q2a-user-activity-plus and verify?)

HOWEVER, I just tried this in my upgraded 1.5 install on localhost and it appears to work just fine (same exact plugin code). So maybe it was an issue that inadvertently got fixed in Q2A 1.5...
by
You're quite right - my apologies. This is happening because, before the request gets to your plugin, Q2A first checks for a category which matches the path. This is where the error is occurring - in Q2A's own code, not yours. Anyway as you say this bug has been fixed for Q2A 1.5. If you want a workaround for Q2A 1.4.x, check for a # in qa-page-default.php, and if it's there, skip the bit that is commented "Get list of questions...". Sorry again!
by
Sorry @gidgreen & @Scott for interrupting your discussion, I want ask @gidgreen a quesion about "# (as well as $ and ^) have special meaning in queries": Where can I find the meaning of #, $ and ^ ? I try to use Google and try to read http://www.question2answer.org/plugins.php but I cannot find them.
by
I've just read what @gidgreen wrote here http://www.question2answer.org/qa/3442/how-to-resolve-insufficient-parameters-registration and guess:

# is used for number VALUES
$ is used for string VALUES (or NaN VALUES)
^ is used for table name
by
If you have separate questions you ought to ask a separate question instead of a comment. You are correct on # and $. ^ is the table /prefix/, i.e. ^ is replaced with qa_ by default, i.e. ^posts = qa_posts
...