Corsi ECM

[insert_php]
define( “DB_HOST”, “editreeit.mydb-aruba.it” );
define( “DB_NAME”, “Swp1646987-prod” );
define( “DB_USR”, “Swp1646987” );
define( “DB_PWD”, “4787jd1068” );

define( “PREFIX”, “A_EDTR_ECM” );

function openDbConn(){
$dbh = new PDO( “mysql:host=” . DB_HOST . “;dbname=” . DB_NAME, DB_USR, DB_PWD );
$dbh->exec( “set names utf8” );

//echo “\nPDO::errorInfo():\n”;
//print_r($dbh->errorInfo());

return $dbh;
}

$dbh=openDbConn();

$sql = “SELECT * FROM `”.PREFIX.”_Corsi` ORDER BY `CRS_data_inizio`”;
$stmt=$dbh->prepare($sql);
$stmt->execute();
$corsi = $stmt->fetchAll(PDO::FETCH_ASSOC);

echo ‘

‘;
foreach($corsi as $k => $c){
$sql = “SELECT * FROM `”.PREFIX.”_Utenti` WHERE CRS_id = “.$c[‘CRS_id’];
$stmt=$dbh->prepare($sql);
$stmt->execute();
$iscritti = $stmt->fetchAll(PDO::FETCH_ASSOC);
echo ‘

‘;
}
echo ‘

ID Ed Titolo Data Sede Iscritti
‘.$c[‘CRS_id’].’ ‘.$c[‘CRS_ed’].’ ‘.$c[‘CRS_titolo’].’ ‘.$c[‘CRS_data’].’ ‘.$c[‘CRS_sede’].’ ‘.count($iscritti).’

‘;

foreach($corsi as $k => $c){
echo ‘

‘;
echo ‘

Corso Residenziale ECM

‘.$c[‘CRS_titolo’].’

‘.$c[‘CRS_data’].’ – ‘.$c[‘CRS_sede’].’

Accreditato ECM – Codice Evento: ‘.$c[‘CRS_ecm’].’
Rivolto a: ‘.$c[‘CRS_prof-disc-text’].’
Responsabili scientifici: ‘.$c[‘CRS_responsabili’].’
Relatori: ‘.$c[‘CRS_relatori’].’

‘;
echo ‘

‘;
}

[/insert_php]