I've fixed the fatal error issue. But the following isn't working. It should print out the array but it isnt'.
PHP Code:
$threadid = $vbulletin->db->query_first("
SELECT threadid
FROM " . TABLE_PREFIX . "thread
WHERE pollid = '".$pollida."'
");
$checkpost = $vbulletin->db->query_read("
SELECT username
FROM " . TABLE_PREFIX . "post
WHERE threadid = '".$threadid."'
");
while ($posts = $db->fetch_array($checkpost))
{
print_r($posts);
}