$usr = "caminha";
$pwd = "d9E738Nr";
$db = "caminha_Autarq2009";
$host = "localhost";
$eleicao="autarq2009";
$cid = mysql_connect($host,$usr,$pwd);
if (!$cid)
{
echo("ERROR: " . mysql_error() . "\n");
}
else
{
/* Câmara Municipal */
$sql="SELECT A.PART_CODE, A.CND_NOME, A.IMG_FILE FROM CM_CND_TBL A, CM_CND_ELT_TBL B WHERE A.PART_CODE=B.PART_CODE AND A.PART_POS=B.PART_POS ORDER BY POS";
$result = mysql_db_query($db,"$sql",$cid);
if (!$result)
{
echo("ERROR: " . mysql_error() . "\n");
}
$num_elt = mysql_num_rows($result);
$i = 0;
While($i < 7)
{
if ($i<$num_elt)
{
$cm_part[$i]=mysql_result($result,$i,"PART_CODE");
$cm_cnd[$i] = utf8_encode(mysql_result($result,$i,"CND_NOME"));
$cm_img[$i] = "IMG/" . mysql_result($result,$i,"IMG_FILE");
}
else
{
$cm_part[$i]="";
$cm_cnd[$i]="";
$cm_img[$i] = "IMG/ponto.jpg";
}
/*
echo("part_code=" . $cm_part[$i] . " ");
echo("cnd_nome=" . $cm_cnd[$i] . " ");
echo("img_file=" . $cm_img[$i] . " ");
*/
$i++;
}
$sql="SELECT lower(concat(A.part_code, '.jpg')) as part_img_cm FROM `PART_TBL` A INNER JOIN CM_PART_TBL B ON A.PART_CODE=B.PART_CODE WHERE `PART_ELG_CND`='S' ORDER BY part_ord";
$result = mysql_db_query($db,"$sql",$cid);
$num_parts = mysql_num_rows($result);
$i=0;
while ($i<$num_parts)
{
$part_img_cm[$i] = "IMG/" . mysql_result($result,$i,"part_img_cm");
$i++;
}
$sql="SELECT A.part_code, CASE WHEN E.VOTANTES IS NULL THEN '' ELSE ROUND( 100 * sum( votos ) / E.VOTANTES, 1 ) END AS prct
FROM `CM_VOT_TBL` A, PART_TBL B, (SELECT SUM( VOTOS) AS VOTANTES FROM `CM_VOT_TBL`) E WHERE B.PART_ELG_CND = 'S' AND A.PART_CODE = B.PART_CODE GROUP BY A.part_code ORDER BY B.PART_ORD";
$result = mysql_db_query($db,"$sql",$cid);
$num_parts = mysql_num_rows($result);
$i=0;
while ($i<$num_parts)
{
if (mysql_result($result,$i,"prct")=="")
{
$prct_cm[$i] = "";
}
else
{
$prct_cm[$i] = mysql_result($result,$i,"prct") . "%";
}
$i++;
}
/* Assembleia Municipal */
$sql="SELECT A.PART_CODE, A.CND_NOME, A.IMG_FILE FROM AM_CND_TBL A, AM_CND_ELT_TBL B WHERE A.PART_CODE=B.PART_CODE AND A.PART_POS=B.PART_POS ORDER BY POS";
$result = mysql_db_query($db,"$sql",$cid);
if (!$result)
{
echo("ERROR: " . mysql_error() . "\n");
}
$num_elt = mysql_num_rows($result);
$i = 0;
While($i < 21)
{
if ($i<$num_elt)
{
$am_part[$i]=mysql_result($result,$i,"PART_CODE");
$am_cnd[$i] = utf8_encode(mysql_result($result,$i,"CND_NOME"));
$am_img[$i] = "IMG/" . mysql_result($result,$i,"IMG_FILE");
}
else
{
$am_part[$i]="";
$am_cnd[$i]="";
$am_img[$i] = "IMG/ponto.jpg";
}
/*
echo("part_code=" . $am_part[$i] . " ");
echo("cnd_nome=" . $am_cnd[$i] . " ");
echo("img_file=" . $am_img[$i] . " ");
*/
$i++;
}
$sql="SELECT lower(concat(A.part_code, '.jpg')) as part_img_am FROM `PART_TBL` A INNER JOIN AM_PART_TBL B ON A.PART_CODE=B.PART_CODE WHERE `PART_ELG_CND`='S' ORDER BY part_ord";
$result = mysql_db_query($db,"$sql",$cid);
$num_parts = mysql_num_rows($result);
$i=0;
while ($i<$num_parts)
{
$part_img_am[$i] = "IMG/" . mysql_result($result,$i,"part_img_am");
$i++;
}
$sql="SELECT A.part_code, CASE WHEN E.VOTANTES IS NULL THEN '' ELSE ROUND( 100 * sum( votos ) / E.VOTANTES, 1 ) END AS prct
FROM `AM_VOT_TBL` A, PART_TBL B, (SELECT SUM( VOTOS) AS VOTANTES FROM `AM_VOT_TBL`) E WHERE B.PART_ELG_CND = 'S' AND A.PART_CODE = B.PART_CODE GROUP BY A.part_code ORDER BY B.PART_ORD";
$result = mysql_db_query($db,"$sql",$cid);
$num_parts = mysql_num_rows($result);
$i=0;
while ($i<$num_parts)
{
if (mysql_result($result,$i,"prct")=="")
{
$prct_am[$i] = "";
}
else
{
$prct_am[$i] = mysql_result($result,$i,"prct") . "%";
}
$i++;
}
/* Assembleia Freguesia de Caminha */
$sql="SELECT A.PART_CODE, A.CND_NOME, A.IMG_FILE FROM AF_CND_TBL A, AF_CND_ELT_TBL B WHERE A.PART_CODE=B.PART_CODE AND A.PART_POS=B.PART_POS AND A.AF_CODE='05' AND A.AF_CODE=B.AF_CODE ORDER BY POS";
$result = mysql_db_query($db,"$sql",$cid);
if (!$result)
{
echo("ERROR: " . mysql_error() . "\n");
}
$num_elt = mysql_num_rows($result);
$i = 0;
While($i < 9)
{
if ($i<$num_elt)
{
$af05_part[$i]=mysql_result($result,$i,"PART_CODE");
$af05_cnd[$i] = utf8_encode(mysql_result($result,$i,"CND_NOME"));
$af05_img[$i] = "IMG/" . mysql_result($result,$i,"IMG_FILE");
}
else
{
$af05_part[$i]="";
$af05_cnd[$i]="";
$af05_img[$i] = "IMG/ponto.jpg";
}
/*
echo("part_code=" . $af05_part[$i] . " ");
echo("cnd_nome=" . $af05_cnd[$i] . " ");
echo("img_file=" . $af05_img[$i] . " ");
*/
$i++;
}
/* Assembleia Freguesia de VPA */
$sql="SELECT A.PART_CODE, A.CND_NOME, A.IMG_FILE FROM AF_CND_TBL A, AF_CND_ELT_TBL B WHERE A.PART_CODE=B.PART_CODE AND A.PART_POS=B.PART_POS AND A.AF_CODE='15' AND A.AF_CODE=B.AF_CODE ORDER BY POS";
$result = mysql_db_query($db,"$sql",$cid);
if (!$result)
{
echo("ERROR: " . mysql_error() . "\n");
}
$num_elt = mysql_num_rows($result);
$i = 0;
While($i < 9)
{
if ($i<$num_elt)
{
$af15_part[$i]=mysql_result($result,$i,"PART_CODE");
$af15_cnd[$i] = utf8_encode(mysql_result($result,$i,"CND_NOME"));
$af15_img[$i] = "IMG/" . mysql_result($result,$i,"IMG_FILE");
}
else
{
$af15_part[$i]="";
$af15_cnd[$i]="";
$af15_img[$i] = "IMG/ponto.jpg";
}
/*
echo("part_code=" . $af15_part[$i] . " ");
echo("cnd_nome=" . $af15_cnd[$i] . " ");
echo("img_file=" . $af15_img[$i] . " ");
*/
$i++;
}
/* Outras Assembleias Freguesia */
$af="01";
$sql="SELECT A.PART_CODE, A.CND_NOME, A.IMG_FILE FROM AF_CND_TBL A, AF_CND_ELT_TBL B WHERE A.PART_CODE=B.PART_CODE AND A.PART_POS=B.PART_POS AND A.AF_CODE=B.AF_CODE AND POS=1 AND A.AF_CODE='" . $af . "'";
$result = mysql_db_query($db,"$sql",$cid);
if (!$result)
{
echo("ERROR: " . mysql_error() . "\n");
}
$num_elt = mysql_num_rows($result);
$i = 0;
if ($i<$num_elt)
{
$af01_part[$i]=mysql_result($result,$i,"PART_CODE");
$af01_cnd[$i] = utf8_encode(mysql_result($result,$i,"CND_NOME"));
$af01_img[$i] = "IMG/" . mysql_result($result,$i,"IMG_FILE");
}
else
{
$af01_part[$i]="";
$af01_cnd[$i]="";
$af01_img[$i] = "IMG/ponto.jpg";
}
/*
echo("part_code=" . $af01_part[$i] . " ");
echo("cnd_nome=" . $af01_cnd[$i] . " ");
echo("img_file=" . $af01_img[$i] . " ");
*/
$af="03";
$sql="SELECT A.PART_CODE, A.CND_NOME, A.IMG_FILE FROM AF_CND_TBL A, AF_CND_ELT_TBL B WHERE A.PART_CODE=B.PART_CODE AND A.PART_POS=B.PART_POS AND A.AF_CODE=B.AF_CODE AND POS=1 AND A.AF_CODE='" . $af . "'";
$result = mysql_db_query($db,"$sql",$cid);
if (!$result)
{
echo("ERROR: " . mysql_error() . "\n");
}
$num_elt = mysql_num_rows($result);
$i = 0;
if ($i<$num_elt)
{
$af03_part[$i]=mysql_result($result,$i,"PART_CODE");
$af03_cnd[$i] = utf8_encode(mysql_result($result,$i,"CND_NOME"));
$af03_img[$i] = "IMG/" . mysql_result($result,$i,"IMG_FILE");
}
else
{
$af03_part[$i]="";
$af03_cnd[$i]="";
$af03_img[$i] = "IMG/ponto.jpg";
}
/*
echo("part_code=" . $af03_part[$i] . " ");
echo("cnd_nome=" . $af03_cnd[$i] . " ");
echo("img_file=" . $af03_img[$i] . " ");
*/
$af="04";
$sql="SELECT A.PART_CODE, A.CND_NOME, A.IMG_FILE FROM AF_CND_TBL A, AF_CND_ELT_TBL B WHERE A.PART_CODE=B.PART_CODE AND A.PART_POS=B.PART_POS AND A.AF_CODE=B.AF_CODE AND POS=1 AND A.AF_CODE='" . $af . "'";
$result = mysql_db_query($db,"$sql",$cid);
if (!$result)
{
echo("ERROR: " . mysql_error() . "\n");
}
$num_elt = mysql_num_rows($result);
$i = 0;
if ($i<$num_elt)
{
$af04_part[$i]=mysql_result($result,$i,"PART_CODE");
$af04_cnd[$i] = utf8_encode(mysql_result($result,$i,"CND_NOME"));
$af04_img[$i] = "IMG/" . mysql_result($result,$i,"IMG_FILE");
}
else
{
$af04_part[$i]="";
$af04_cnd[$i]="";
$af04_img[$i] = "IMG/ponto.jpg";
}
/*
echo("part_code=" . $af04_part[$i] . " ");
echo("cnd_nome=" . $af04_cnd[$i] . " ");
echo("img_file=" . $af04_img[$i] . " ");
*/
$af="06";
$sql="SELECT A.PART_CODE, A.CND_NOME, A.IMG_FILE FROM AF_CND_TBL A, AF_CND_ELT_TBL B WHERE A.PART_CODE=B.PART_CODE AND A.PART_POS=B.PART_POS AND A.AF_CODE=B.AF_CODE AND POS=1 AND A.AF_CODE='" . $af . "'";
$result = mysql_db_query($db,"$sql",$cid);
if (!$result)
{
echo("ERROR: " . mysql_error() . "\n");
}
$num_elt = mysql_num_rows($result);
$i = 0;
if ($i<$num_elt)
{
$af06_part[$i]=mysql_result($result,$i,"PART_CODE");
$af06_cnd[$i] = utf8_encode(mysql_result($result,$i,"CND_NOME"));
$af06_img[$i] = "IMG/" . mysql_result($result,$i,"IMG_FILE");
}
else
{
$af06_part[$i]="";
$af06_cnd[$i]="";
$af06_img[$i] = "IMG/ponto.jpg";
}
/*
echo("part_code=" . $af06_part[$i] . " ");
echo("cnd_nome=" . $af06_cnd[$i] . " ");
echo("img_file=" . $af06_img[$i] . " ");
*/
$af="07";
$sql="SELECT A.PART_CODE, A.CND_NOME, A.IMG_FILE FROM AF_CND_TBL A, AF_CND_ELT_TBL B WHERE A.PART_CODE=B.PART_CODE AND A.PART_POS=B.PART_POS AND A.AF_CODE=B.AF_CODE AND POS=1 AND A.AF_CODE='" . $af . "'";
$result = mysql_db_query($db,"$sql",$cid);
if (!$result)
{
echo("ERROR: " . mysql_error() . "\n");
}
$num_elt = mysql_num_rows($result);
$i = 0;
if ($i<$num_elt)
{
$af07_part[$i]=mysql_result($result,$i,"PART_CODE");
$af07_cnd[$i] = utf8_encode(mysql_result($result,$i,"CND_NOME"));
$af07_img[$i] = "IMG/" . mysql_result($result,$i,"IMG_FILE");
}
else
{
$af07_part[$i]="";
$af07_cnd[$i]="";
$af07_img[$i] = "IMG/ponto.jpg";
}
/*
echo("part_code=" . $af07_part[$i] . " ");
echo("cnd_nome=" . $af07_cnd[$i] . " ");
echo("img_file=" . $af07_img[$i] . " ");
*/
$af="08";
$sql="SELECT A.PART_CODE, A.CND_NOME, A.IMG_FILE FROM AF_CND_TBL A, AF_CND_ELT_TBL B WHERE A.PART_CODE=B.PART_CODE AND A.PART_POS=B.PART_POS AND A.AF_CODE=B.AF_CODE AND POS=1 AND A.AF_CODE='" . $af . "'";
$result = mysql_db_query($db,"$sql",$cid);
if (!$result)
{
echo("ERROR: " . mysql_error() . "\n");
}
$num_elt = mysql_num_rows($result);
$i = 0;
if ($i<$num_elt)
{
$af08_part[$i]=mysql_result($result,$i,"PART_CODE");
$af08_cnd[$i] = utf8_encode(mysql_result($result,$i,"CND_NOME"));
$af08_img[$i] = "IMG/" . mysql_result($result,$i,"IMG_FILE");
}
else
{
$af08_part[$i]="";
$af08_cnd[$i]="";
$af08_img[$i] = "IMG/ponto.jpg";
}
/*
echo("part_code=" . $af08_part[$i] . " ");
echo("cnd_nome=" . $af08_cnd[$i] . " ");
echo("img_file=" . $af08_img[$i] . " ");
*/
$af="09";
$sql="SELECT A.PART_CODE, A.CND_NOME, A.IMG_FILE FROM AF_CND_TBL A, AF_CND_ELT_TBL B WHERE A.PART_CODE=B.PART_CODE AND A.PART_POS=B.PART_POS AND A.AF_CODE=B.AF_CODE AND POS=1 AND A.AF_CODE='" . $af . "'";
$result = mysql_db_query($db,"$sql",$cid);
if (!$result)
{
echo("ERROR: " . mysql_error() . "\n");
}
$num_elt = mysql_num_rows($result);
$i = 0;
if ($i<$num_elt)
{
$af09_part[$i]=mysql_result($result,$i,"PART_CODE");
$af09_cnd[$i] = utf8_encode(mysql_result($result,$i,"CND_NOME"));
$af09_img[$i] = "IMG/" . mysql_result($result,$i,"IMG_FILE");
}
else
{
$af09_part[$i]="";
$af09_cnd[$i]="";
$af09_img[$i] = "IMG/ponto.jpg";
}
/*
echo("part_code=" . $af09_part[$i] . " ");
echo("cnd_nome=" . $af09_cnd[$i] . " ");
echo("img_file=" . $af09_img[$i] . " ");
*/
$af="10";
$sql="SELECT A.PART_CODE, A.CND_NOME, A.IMG_FILE FROM AF_CND_TBL A, AF_CND_ELT_TBL B WHERE A.PART_CODE=B.PART_CODE AND A.PART_POS=B.PART_POS AND A.AF_CODE=B.AF_CODE AND POS=1 AND A.AF_CODE='" . $af . "'";
$result = mysql_db_query($db,"$sql",$cid);
if (!$result)
{
echo("ERROR: " . mysql_error() . "\n");
}
$num_elt = mysql_num_rows($result);
$i = 0;
if ($i<$num_elt)
{
$af10_part[$i]=mysql_result($result,$i,"PART_CODE");
$af10_cnd[$i] = utf8_encode(mysql_result($result,$i,"CND_NOME"));
$af10_img[$i] = "IMG/" . mysql_result($result,$i,"IMG_FILE");
}
else
{
$af10_part[$i]="";
$af10_cnd[$i]="";
$af10_img[$i] = "IMG/ponto.jpg";
}
/*
echo("part_code=" . $af10_part[$i] . " ");
echo("cnd_nome=" . $af10_cnd[$i] . " ");
echo("img_file=" . $af10_img[$i] . " ");
*/
$af="11";
$sql="SELECT A.PART_CODE, A.CND_NOME, A.IMG_FILE FROM AF_CND_TBL A, AF_CND_ELT_TBL B WHERE A.PART_CODE=B.PART_CODE AND A.PART_POS=B.PART_POS AND A.AF_CODE=B.AF_CODE AND POS=1 AND A.AF_CODE='" . $af . "'";
$result = mysql_db_query($db,"$sql",$cid);
if (!$result)
{
echo("ERROR: " . mysql_error() . "\n");
}
$num_elt = mysql_num_rows($result);
$i = 0;
if ($i<$num_elt)
{
$af11_part[$i]=mysql_result($result,$i,"PART_CODE");
$af11_cnd[$i] = utf8_encode(mysql_result($result,$i,"CND_NOME"));
$af11_img[$i] = "IMG/" . mysql_result($result,$i,"IMG_FILE");
}
else
{
$af11_part[$i]="";
$af11_cnd[$i]="";
$af11_img[$i] = "IMG/ponto.jpg";
}
/*
echo("part_code=" . $af11_part[$i] . " ");
echo("cnd_nome=" . $af11_cnd[$i] . " ");
echo("img_file=" . $af11_img[$i] . " ");
*/
$af="12";
$sql="SELECT A.PART_CODE, A.CND_NOME, A.IMG_FILE FROM AF_CND_TBL A, AF_CND_ELT_TBL B WHERE A.PART_CODE=B.PART_CODE AND A.PART_POS=B.PART_POS AND A.AF_CODE=B.AF_CODE AND POS=1 AND A.AF_CODE='" . $af . "'";
$result = mysql_db_query($db,"$sql",$cid);
if (!$result)
{
echo("ERROR: " . mysql_error() . "\n");
}
$num_elt = mysql_num_rows($result);
$i = 0;
if ($i<$num_elt)
{
$af12_part[$i]=mysql_result($result,$i,"PART_CODE");
$af12_cnd[$i] = utf8_encode(mysql_result($result,$i,"CND_NOME"));
$af12_img[$i] = "IMG/" . mysql_result($result,$i,"IMG_FILE");
}
else
{
$af12_part[$i]="";
$af12_cnd[$i]="";
$af12_img[$i] = "IMG/ponto.jpg";
}
/*
echo("part_code=" . $af12_part[$i] . " ");
echo("cnd_nome=" . $af12_cnd[$i] . " ");
echo("img_file=" . $af12_img[$i] . " ");
*/
$af="13";
$sql="SELECT A.PART_CODE, A.CND_NOME, A.IMG_FILE FROM AF_CND_TBL A, AF_CND_ELT_TBL B WHERE A.PART_CODE=B.PART_CODE AND A.PART_POS=B.PART_POS AND A.AF_CODE=B.AF_CODE AND POS=1 AND A.AF_CODE='" . $af . "'";
$result = mysql_db_query($db,"$sql",$cid);
if (!$result)
{
echo("ERROR: " . mysql_error() . "\n");
}
$num_elt = mysql_num_rows($result);
$i = 0;
if ($i<$num_elt)
{
$af13_part[$i]=mysql_result($result,$i,"PART_CODE");
$af13_cnd[$i] = utf8_encode(mysql_result($result,$i,"CND_NOME"));
$af13_img[$i] = "IMG/" . mysql_result($result,$i,"IMG_FILE");
}
else
{
$af13_part[$i]="";
$af13_cnd[$i]="";
$af13_img[$i] = "IMG/ponto.jpg";
}
/*
echo("part_code=" . $af13_part[$i] . " ");
echo("cnd_nome=" . $af13_cnd[$i] . " ");
echo("img_file=" . $af13_img[$i] . " ");
*/
$af="14";
$sql="SELECT A.PART_CODE, A.CND_NOME, A.IMG_FILE FROM AF_CND_TBL A, AF_CND_ELT_TBL B WHERE A.PART_CODE=B.PART_CODE AND A.PART_POS=B.PART_POS AND A.AF_CODE=B.AF_CODE AND POS=1 AND A.AF_CODE='" . $af . "'";
$result = mysql_db_query($db,"$sql",$cid);
if (!$result)
{
echo("ERROR: " . mysql_error() . "\n");
}
$num_elt = mysql_num_rows($result);
$i = 0;
if ($i<$num_elt)
{
$af14_part[$i]=mysql_result($result,$i,"PART_CODE");
$af14_cnd[$i] = utf8_encode(mysql_result($result,$i,"CND_NOME"));
$af14_img[$i] = "IMG/" . mysql_result($result,$i,"IMG_FILE");
}
else
{
$af14_part[$i]="";
$af14_cnd[$i]="";
$af14_img[$i] = "IMG/ponto.jpg";
}
/*
echo("part_code=" . $af14_part[$i] . " ");
echo("cnd_nome=" . $af14_cnd[$i] . " ");
echo("img_file=" . $af14_img[$i] . " ");
*/
$af="16";
$sql="SELECT A.PART_CODE, A.CND_NOME, A.IMG_FILE FROM AF_CND_TBL A, AF_CND_ELT_TBL B WHERE A.PART_CODE=B.PART_CODE AND A.PART_POS=B.PART_POS AND A.AF_CODE=B.AF_CODE AND POS=1 AND A.AF_CODE='" . $af . "'";
$result = mysql_db_query($db,"$sql",$cid);
if (!$result)
{
echo("ERROR: " . mysql_error() . "\n");
}
$num_elt = mysql_num_rows($result);
$i = 0;
if ($i<$num_elt)
{
$af16_part[$i]=mysql_result($result,$i,"PART_CODE");
$af16_cnd[$i] = utf8_encode(mysql_result($result,$i,"CND_NOME"));
$af16_img[$i] = "IMG/" . mysql_result($result,$i,"IMG_FILE");
}
else
{
$af16_part[$i]="";
$af16_cnd[$i]="";
$af16_img[$i] = "IMG/ponto.jpg";
}
/*
echo("part_code=" . $af16_part[$i] . " ");
echo("cnd_nome=" . $af16_cnd[$i] . " ");
echo("img_file=" . $af16_img[$i] . " ");
*/
$af="17";
$sql="SELECT A.PART_CODE, A.CND_NOME, A.IMG_FILE FROM AF_CND_TBL A, AF_CND_ELT_TBL B WHERE A.PART_CODE=B.PART_CODE AND A.PART_POS=B.PART_POS AND A.AF_CODE=B.AF_CODE AND POS=1 AND A.AF_CODE='" . $af . "'";
$result = mysql_db_query($db,"$sql",$cid);
if (!$result)
{
echo("ERROR: " . mysql_error() . "\n");
}
$num_elt = mysql_num_rows($result);
$i = 0;
if ($i<$num_elt)
{
$af17_part[$i]=mysql_result($result,$i,"PART_CODE");
$af17_cnd[$i] = utf8_encode(mysql_result($result,$i,"CND_NOME"));
$af17_img[$i] = "IMG/" . mysql_result($result,$i,"IMG_FILE");
}
else
{
$af17_part[$i]="";
$af17_cnd[$i]="";
$af17_img[$i] = "IMG/ponto.jpg";
}
/*
echo("part_code=" . $af17_part[$i] . " ");
echo("cnd_nome=" . $af17_cnd[$i] . " ");
echo("img_file=" . $af17_img[$i] . " ");
*/
$af="18";
$sql="SELECT A.PART_CODE, A.CND_NOME, A.IMG_FILE FROM AF_CND_TBL A, AF_CND_ELT_TBL B WHERE A.PART_CODE=B.PART_CODE AND A.PART_POS=B.PART_POS AND A.AF_CODE=B.AF_CODE AND POS=1 AND A.AF_CODE='" . $af . "'";
$result = mysql_db_query($db,"$sql",$cid);
if (!$result)
{
echo("ERROR: " . mysql_error() . "\n");
}
$num_elt = mysql_num_rows($result);
$i = 0;
if ($i<$num_elt)
{
$af18_part[$i]=mysql_result($result,$i,"PART_CODE");
$af18_cnd[$i] = utf8_encode(mysql_result($result,$i,"CND_NOME"));
$af18_img[$i] = "IMG/" . mysql_result($result,$i,"IMG_FILE");
}
else
{
$af18_part[$i]="";
$af18_cnd[$i]="";
$af18_img[$i] = "IMG/ponto.jpg";
}
/*
echo("part_code=" . $af18_part[$i] . " ");
echo("cnd_nome=" . $af18_cnd[$i] . " ");
echo("img_file=" . $af18_img[$i] . " ");
*/
mysql_close($cid);
}
?>
JORNAL DIGITAL REGIONAL CAMINHA 2000
"Contem comigo mais quatro anos!" - Julia Paula