The query relies on threadid being supplied as either a GET or POST variable, if neither exists it will fail as above. It's impossible to tell if it was supplied as you have edited the calling script details in the error message.
The query also seems somewhat strange in the first place ;
SELECT userid FROM post where threadid = <any number> AND userid = 1
Basically Select userid where userid = 1