Source of: /ADI/displayTable_mysql/filmes6.php

<?php
require_once "HTML/Template/IT.php";
include
'inc/db.inc';

// mostra os actores numa selectList
function displaySelect($result)
{

 
// Cria um novo objecto template
 
$template = new HTML_Template_IT('.');
 
// Carrega o template Filmes2_TemplateIT.html
 
$template->loadTemplatefile('filmes6_templateIT.html', true, true);
  
 
$nrows  = mysql_num_rows($result);
  if(
$nrows > 0 ) {
   for(
$i=0; $i<$nrows; $i++) {
    
$tuple = mysql_fetch_array($result,MYSQL_ASSOC);
    
$nomeActor = $tuple["nomeactor"];
    
$template->setCurrentBlock("NOMES");
      
$template->setVariable('NOME', $nomeActor);
    
$template->parseCurrentBlock();
   }
// end for

 
} // end if
 
$template->show();
}





// ligação à base de dados
$db = dbconnect($hostname,$db_name,$db_user,$db_passwd);
if(
$db) {
 
// criar query numa string
 
$query  = "SELECT DISTINCT nomeactor FROM participa";
 
 
// executar a query
 
if(!($result = @ mysql_query($query,$db )))
  
showerror();

 
// mostra o resultado
 
displaySelect($result);
 
 

 
// fechar a ligação à base de dados
 
mysql_close($db);

}
//end if
?>