Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+1 vote
1.5k views
in Q2A Core by
Hi,

I have installed the script but when i click in the question i have (Question not found). When i am connected admin its ok... I dont have hidden questions. (No hidden questions, answers or comments found).

Thank you for answer...

Nicolas
by
Can you please post a link so I can take a look?

2 Answers

0 votes
by
 
Best answer
Summarized answer since this seems to be a common problem:

This is due to a bug in MySQL 5.1.46 and 5.1.47:

http://bugs.mysql.com/bug.php?id=53334

(The LEFT JOIN using a condition that is definitely false (=NULL) makes the results empty, when it should simply create a NULL column.)

For now the solution is to change this line in qa-db-selects.php:

$selectspec['source'].=' LEFT JOIN ^uservotes ON ^posts.postid=^uservotes.postid AND ^uservotes.userid=$';

... to ...

$selectspec['source'].=' LEFT JOIN ^uservotes ON ^posts.postid=^uservotes.postid AND ^uservotes.userid=COALESCE($,0)';

The next version of Q2A will work around this a different way.
by
MySQL 5.1.47 and Q2A 1.0 has this issue
MySQL 5.1.47 and Q2A 1.2 Preview 5 has this issue
but MySQL 5.1.47 and Q2A 1.0.1 is working fine. why is so?
by
The bug only appears if you're not logged in, but I assuming that was the case when you tested with 1.0.1? If so, I don't know the reason - it's a bug, so by its nature, it might only appear under certain circumstances.
by
I agree with you, but even without login everything works fine.
I'm still running Q2A 1.0.1 version with MySQL 5.1.47 on http://answers.prothoughts.com, pls have a look.
0 votes
by
by
Thanks. Can you make the following change in qa-config.php so I can see what database queries are being sent:

define('QA_DEBUG_PERFORMANCE', false);

... to ...

define('QA_DEBUG_PERFORMANCE', true);

Also, are you able to send me a dump of the database contents, especially the qa_posts table?
by
Both servers with this problem seem to be running PHP 5.2.13, so I suspect it has something to do with that version. Will look further...
by
Ok i have reinstall the script at ( http://solution.askosweb.com/test/ )

Because ( http://solution.askosweb.com/ ) i have try to install beta 3.0 and its the same problem. I have remove and install the release. For this reason i am not sure its good dump.

Now i have install just the script at ( http://solution.askosweb.com/test/  ) and i dont have change nothing no option...

The report (Dump) :

(SELECT '0' AS selectkey, qa_posts.postid, qa_posts.type, LEFT(qa_posts.type,1) AS basetype, INSTR(qa_posts.type, '_HIDDEN')>0 AS hidden, qa_posts.acount, qa_posts.upvotes, qa_posts.downvotes, BINARY qa_posts.title AS title, BINARY qa_posts.tags AS tags, UNIX_TIMESTAMP(qa_posts.created) AS created, qa_uservotes.vote AS uservote, qa_posts.userid, qa_posts.cookieid, qa_userpoints.points, BINARY qa_users.handle AS handle, NULL AS apostid, NULL AS auserid, NULL AS acookieid, NULL AS acreated, NULL AS apoints, NULL AS ahandle, NULL AS content FROM qa_posts LEFT JOIN qa_uservotes ON qa_posts.postid=qa_uservotes.postid AND qa_uservotes.userid=NULL LEFT JOIN qa_users ON qa_posts.userid=qa_users.userid LEFT JOIN qa_userpoints ON qa_posts.userid=qa_userpoints.userid JOIN (SELECT postid FROM qa_posts WHERE type=_utf8 'Q' ORDER BY qa_posts.created DESC LIMIT 0,50) y ON qa_posts.postid=y.postid) UNION ALL (SELECT '1', qa_posts.postid, qa_posts.type, LEFT(qa_posts.type,1), INSTR(qa_posts.type, '_HIDDEN')>0, qa_posts.acount, qa_posts.upvotes, qa_posts.downvotes, BINARY qa_posts.title, BINARY qa_posts.tags, UNIX_TIMESTAMP(qa_posts.created), qa_uservotes.vote, qa_posts.userid, qa_posts.cookieid, qa_userpoints.points, BINARY qa_users.handle, aposts.postid, aposts.userid, aposts.cookieid, UNIX_TIMESTAMP(aposts.created), auserpoints.points, BINARY ausers.handle, NULL FROM qa_posts LEFT JOIN qa_uservotes ON qa_posts.postid=qa_uservotes.postid AND qa_uservotes.userid=NULL LEFT JOIN qa_users ON qa_posts.userid=qa_users.userid LEFT JOIN qa_userpoints ON qa_posts.userid=qa_userpoints.userid JOIN qa_posts AS aposts ON qa_posts.postid=aposts.parentid LEFT JOIN qa_users AS ausers ON aposts.userid=ausers.userid LEFT JOIN qa_userpoints AS auserpoints ON aposts.userid=auserpoints.userid JOIN (SELECT postid FROM qa_posts WHERE type=_utf8 'A' ORDER BY qa_posts.created DESC LIMIT 0,50) y ON aposts.postid=y.postid WHERE qa_posts.type!='Q_HIDDEN') UNION ALL (SELECT '_options', NULL, NULL, NULL, NULL, NULL, NULL, NULL, title, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, BINARY content FROM qa_options WHERE title IN (_utf8 'site_title',_utf8 'logo_show',_utf8 'logo_url',_utf8 'logo_width',_utf8 'logo_height',_utf8 'feedback_enabled',_utf8 'nav_unanswered',_utf8 'site_language',_utf8 'site_theme',_utf8 'neat_urls',_utf8 'custom_sidebar',_utf8 'custom_header',_utf8 'custom_footer',_utf8 'custom_in_head',_utf8 'pages_prev_next',_utf8 'voting_on_qs',_utf8 'votes_separated',_utf8 'show_user_points',_utf8 'page_size_home'))

Is that what you wanted ?

Thank you

Nicolas
by
Thanks very much for your response. The dump I'd be most interested in is from the page where the error is shown, not the front page.
by
Question not found ( http://solution.askosweb.com/test/2/fxghfg-hsggf-hgfh-gdhgfh-dfghd )

Result for this page :

(SELECT '0' AS selectkey, qa_posts.postid, qa_posts.type, LEFT(qa_posts.type,1) AS basetype, INSTR(qa_posts.type, '_HIDDEN')>0 AS hidden, qa_posts.acount, qa_posts.upvotes, qa_posts.downvotes, BINARY qa_posts.title AS title, BINARY qa_posts.tags AS tags, UNIX_TIMESTAMP(qa_posts.created) AS created, qa_uservotes.vote AS uservote, BINARY qa_posts.content AS content, BINARY qa_posts.notify AS notify, UNIX_TIMESTAMP(qa_posts.updated) AS updated, qa_posts.format, qa_posts.lastuserid, qa_posts.parentid, qa_posts.selchildid, qa_posts.userid, qa_posts.cookieid, qa_userpoints.points, BINARY qa_users.handle AS handle, BINARY lastusers.handle AS lasthandle, NULL AS score FROM qa_posts LEFT JOIN qa_uservotes ON qa_posts.postid=qa_uservotes.postid AND qa_uservotes.userid=NULL LEFT JOIN qa_users ON qa_posts.userid=qa_users.userid LEFT JOIN qa_users AS lastusers ON qa_posts.lastuserid=lastusers.userid LEFT JOIN qa_userpoints ON qa_posts.userid=qa_userpoints.userid WHERE qa_posts.postid=2) UNION ALL (SELECT '1', qa_posts.postid, qa_posts.type, LEFT(qa_posts.type,1), INSTR(qa_posts.type, '_HIDDEN')>0, qa_posts.acount, qa_posts.upvotes, qa_posts.downvotes, BINARY qa_posts.title, BINARY qa_posts.tags, UNIX_TIMESTAMP(qa_posts.created), qa_uservotes.vote, BINARY qa_posts.content, BINARY qa_posts.notify, UNIX_TIMESTAMP(qa_posts.updated), qa_posts.format, qa_posts.lastuserid, qa_posts.parentid, qa_posts.selchildid, qa_posts.userid, qa_posts.cookieid, qa_userpoints.points, BINARY qa_users.handle, BINARY lastusers.handle, NULL FROM qa_posts LEFT JOIN qa_uservotes ON qa_posts.postid=qa_uservotes.postid AND qa_uservotes.userid=NULL LEFT JOIN qa_users ON qa_posts.userid=qa_users.userid LEFT JOIN qa_users AS lastusers ON qa_posts.lastuserid=lastusers.userid LEFT JOIN qa_userpoints ON qa_posts.userid=qa_userpoints.userid WHERE qa_posts.parentid=2) UNION ALL (SELECT '2', qa_posts.postid, qa_posts.type, LEFT(qa_posts.type,1), INSTR(qa_posts.type, '_HIDDEN')>0, qa_posts.acount, qa_posts.upvotes, qa_posts.downvotes, BINARY qa_posts.title, BINARY qa_posts.tags, UNIX_TIMESTAMP(qa_posts.created), qa_uservotes.vote, BINARY qa_posts.content, BINARY qa_posts.notify, UNIX_TIMESTAMP(qa_posts.updated), qa_posts.format, qa_posts.lastuserid, qa_posts.parentid, qa_posts.selchildid, qa_posts.userid, qa_posts.cookieid, qa_userpoints.points, BINARY qa_users.handle, BINARY lastusers.handle, NULL FROM qa_posts LEFT JOIN qa_uservotes ON qa_posts.postid=qa_uservotes.postid AND qa_uservotes.userid=NULL LEFT JOIN qa_users ON qa_posts.userid=qa_users.userid LEFT JOIN qa_users AS lastusers ON qa_posts.lastuserid=lastusers.userid LEFT JOIN qa_userpoints ON qa_posts.userid=qa_userpoints.userid JOIN qa_posts AS parents ON qa_posts.parentid=parents.postid WHERE parents.parentid=2 AND (parents.type='A' OR parents.type='A_HIDDEN')) UNION ALL (SELECT '3', qa_posts.postid, qa_posts.type, LEFT(qa_posts.type,1), INSTR(qa_posts.type, '_HIDDEN')>0, qa_posts.acount, qa_posts.upvotes, qa_posts.downvotes, BINARY qa_posts.title, BINARY qa_posts.tags, UNIX_TIMESTAMP(qa_posts.created), NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, qa_posts.userid, qa_posts.cookieid, qa_userpoints.points, BINARY qa_users.handle, NULL, NULL FROM qa_posts LEFT JOIN qa_users ON qa_posts.userid=qa_users.userid LEFT JOIN qa_userpoints ON qa_posts.userid=qa_userpoints.userid WHERE qa_posts.postid=(SELECT IF((parent.type='A') OR (parent.type='A_HIDDEN'), parent.parentid, parent.postid) FROM qa_posts AS child LEFT JOIN qa_posts AS parent ON parent.postid=child.parentid WHERE child.postid=2)) UNION ALL (SELECT '4', qa_posts.postid, qa_posts.type, LEFT(qa_posts.type,1), INSTR(qa_posts.type, '_HIDDEN')>0, qa_posts.acount, qa_posts.upvotes, qa_posts.downvotes, BINARY qa_posts.title, BINARY qa_posts.tags, UNIX_TIMESTAMP(qa_posts.created), qa_uservotes.vote, NULL, NULL, NULL, NULL, NULL, NULL, NULL, qa_posts.userid, qa_posts.cookieid, qa_userpoints.points, BINARY qa_users.handle, NULL, score FROM qa_posts LEFT JOIN qa_uservotes ON qa_posts.postid=qa_uservotes.postid AND qa_uservotes.userid=NULL LEFT JOIN qa_users ON qa_posts.userid=qa_users.userid LEFT JOIN qa_userpoints ON qa_posts.userid=qa_userpoints.userid JOIN (SELECT postid, SUM(score)+LOG(postid)/1000000 AS score FROM ((SELECT qa_titlewords.postid, LOG(10000/titlecount) AS score FROM qa_titlewords JOIN qa_words ON qa_titlewords.wordid=qa_words.wordid JOIN qa_titlewords AS source ON qa_titlewords.wordid=source.wordid WHERE source.postid=2 AND titlecount<10000) UNION ALL (SELECT qa_posttags.postid, 2*LOG(10000/tagcount) AS score FROM qa_posttags JOIN qa_words ON qa_posttags.wordid=qa_words.wordid JOIN qa_posttags AS source ON qa_posttags.wordid=source.wordid WHERE source.postid=2 AND tagcount<10000)) x GROUP BY postid ORDER BY score DESC LIMIT 50) y ON qa_posts.postid=y.postid) UNION ALL (SELECT '_options', NULL, NULL, NULL, NULL, NULL, NULL, NULL, title, NULL, NULL, NULL, BINARY content, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL FROM qa_options WHERE title IN (_utf8 'site_title',_utf8 'logo_show',_utf8 'logo_url',_utf8 'logo_width',_utf8 'logo_height',_utf8 'feedback_enabled',_utf8 'nav_unanswered',_utf8 'site_language',_utf8 'site_theme',_utf8 'neat_urls',_utf8 'custom_sidebar',_utf8 'custom_header',_utf8 'custom_footer',_utf8 'custom_in_head',_utf8 'pages_prev_next',_utf8 'answer_needs_login',_utf8 'do_related_qs',_utf8 'page_size_related_qs',_utf8 'match_related_qs',_utf8 'page_size_ask_tags',_utf8 'do_complete_tags',_utf8 'show_url_links',_utf8 'voting_on_qs',_utf8 'voting_on_as',_utf8 'votes_separated',_utf8 'comment_on_qs',_utf8 'comment_on_as',_utf8 'follow_on_as',_utf8 'comment_needs_login',_utf8 'captcha_on_anon_post',_utf8 'show_user_points',_utf8 'recaptcha_public_key',_utf8 'recaptcha_private_key'))

But you know when i am connected in admin i see the same page ok (no Question not found) i see the question...

Nicolas
by
Nicolas - I believe I understand the problem. To help confirm this. you please let me know what version of MySQL you are running?
by
Version MySQL 5.1.46
by
Thanks - as I thought. Here's the MySQL bug that's causing this:

http://bugs.mysql.com/bug.php?id=53334

Here are a couple of workarounds to try by modifying qa-db-selects.php.

Original line of code:

$selectspec['source'].=' LEFT JOIN ^uservotes ON ^posts.postid=^uservotes.postid AND ^uservotes.userid=$';

New version:

$selectspec['source'].=' LEFT JOIN ^uservotes ON ^posts.postid=^uservotes.postid AND ^uservotes.userid<=>$';

Or try:

$selectspec['source'].=' LEFT JOIN ^uservotes ON ^posts.postid=^uservotes.postid AND ^uservotes.userid=COALESCE($,0)';

Please let me know if either of these works.
by
Ok nice, thank you now its ok :)

This :

$selectspec['source'].=' LEFT JOIN ^uservotes ON ^posts.postid=^uservotes.postid AND ^uservotes.userid=COALESCE($,0)';

Nicolas
by
Thanks alot! that fixed the problem perfectly!
...