Novos Analistas-Tributários

$s = "webserver.sindireceita.org.br";
$u = "OpWEB001";
$p = "9o8i1q2w";
$b = "cadastro";


$vaiS = mssql_connect($s, $u, $p) or die(mssql_get_last_message());
mssql_select_db($b, $vaiS) or die(mssql_get_last_message());

$q = "SELECT D.Id_US AS 'CO_UNIDADE_SINDICAL', D.UF, RTRIM(D.NOME) AS 'NO_UNIDADE_SINDICAL' FROM Filiado AS F INNER JOIN DS_CEDS AS D ON F.IDUS = D.Id_US WHERE F.SIT_SIND = '0' AND F.INSTITUIDOR = '0' AND SUBSTRING(CONVERT(CHAR(10), DT_FILIACAO, 103), 7, 4) = '2011' GROUP BY ID_US, UF, NOME ORDER BY D.UF, D.NOME";
$rd = mssql_query($q);

?>

while ($rowd = mssql_fetch_array($rd)) {
$CO_UNI = $rowd[CO_UNIDADE_SINDICAL];
?>




$x = "SELECT F.NOME_I AS 'NO_SERVIDOR' FROM Filiado AS F INNER JOIN DS_CEDS AS D ON F.IDUS = D.Id_US WHERE SIT_SIND = '0' AND INSTITUIDOR = '0' AND SUBSTRING(CONVERT(CHAR(10), DT_FILIACAO, 103), 7, 4) = '2011' AND IDUS = $CO_UNI ORDER BY F.NOME_I";
$rx = mssql_query($x);

while ($rowx = mssql_fetch_array($rx)) {
?>
   - 

}
?>

}
?>