Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+1 vote
1.2k views
in Q2A Core by
How to get current post id ( question ID)?
Q2A version: 1.5.3
by
I have tried
$query_p = "SELECT * FROM ^posts
WHERE type='Q' and postid < [id]
ORDER BY postid DESC LIMIT 1";

and

$query_p = "SELECT * FROM ^posts
WHERE type='Q' and postid < {postid}
ORDER BY postid DESC LIMIT 1";

But none of getting current question id

2 Answers

+1 vote
by
 
Best answer

Got an answer by monk33

 

$myurl=$this->request;
$myurlpieces = explode("/", $myurl);
$myurl=$myurlpieces[0];
by
Thanks ! Any way to get answer ID ? Even better and comment id ?
0 votes
by

this solution will work too.

...