would be nicer to use the $query = $db->getQuery(true);
$query->select('label, id')->from.....
syntax
Oh and definately use $db->quote($formid) or cast $formid it an integer