Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.

find unanswered question in mysql?

+3 votes
99 views
asked Apr 14 in Q2A Core by atanik
hello, i am trying to modify random  question viewer plugin. But in that plug shows all question. i want to show unanswered random question. there is a query.

 function output_widget() {
        $random_question = qa_db_read_one_assoc(
            qa_db_query_sub('SELECT * FROM ^posts WHERE  type=$
            ORDER BY rand()
            LIMIT 1',
            'Q'),
                true );

how i can find unanswered question from mysql?

thank you.
Q2A version: 1,8
commented Apr 14 by Zeeshan
Yeah I also want this
commented Apr 14 by pupi1985
What's the repository link?
commented Apr 17 by atanik
https://github.com/bluegenel/q2a-random-question
q2a-random-question.php line start from 42

1 Answer

+2 votes
answered Apr 17 by pupi1985
selected Apr 17 by atanik
 
Best answer
Just replace this line:

qa_db_query_sub('SELECT * FROM ^posts WHERE  type=$

With this line:

qa_db_query_sub('SELECT * FROM ^posts WHERE  type=$ AND acount = 0
commented Apr 17 by atanik
yeah. it is working. thank you @pupi1985
...