Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+1 vote
545 views
in Q2A Core by
closed by
Is there a way to get the Answer url (maybe the first answer) if we know the postid of the question? For example, $question is the postid of the question, can I use function qa_q_path_html to get the answer url?
Q2A version: 1.8.5
closed with the note: Nobody cares
by
The DB query isn't that complicated. Something along the lines of this should give you the ID of the first answer to the question with the given ID:

SELECT postid FROM qa_posts WHERE parentid = $question ORDER BY created LIMIT 1;

Also, how about giving us more just a couple hours before you decide that nobody cares?

1 Answer

0 votes
by

An alternative: Create an anchor like <a name="jump"></a> near the area of answers you want to move. A link like yoursite.com/12345/this-is-a-question#jump will jump to that section.

by
+1
Isn't it already there with jump being the answerid?
by
edited by
Can't get the answerid with just questionid. We have to do a MysQL query to get its child posts.  So too complicated for a simple purpose.

Ah, I know that you mean the so-called "qa-q-item-what" link. Since I list "questions" only, not "questions and answers". So there is no 'qa-q-item-what' answer link.

I'm trying to create a button that functions like that kind of link.
...