prova a fare cosi...
$query_id = "SELECT id FROM sondaggio WHERE stato LIKE 'attivo' ";