assign('reg_opt', array( "" => "", "N/A"=>"Sigla non inserita", "ABRUZZO"=>"ABRUZZO", "BASILICATA"=>"BASILICATA", "CALABRIA"=>"CALABRIA", "CAMPANIA"=>"CAMPANIA", "EMILIA - ROMAGNA"=>"EMILIA - ROMAGNA", "FRIULI - VENEZIA GIULIA"=>"FRIULI - VENEZIA GIULIA", "LAZIO"=>"LAZIO", "LIGURIA"=>"LIGURIA", "LOMBARDIA"=>"LOMBARDIA", "MARCHE"=>"MARCHE", "MOLISE"=>"MOLISE", "PIEMONTE"=>"PIEMONTE", "PUGLIA"=>"PUGLIA", "SARDEGNA"=>"SARDEGNA", "SICILIA"=>"SICILIA", "TOSCANA"=>"TOSCANA", "TRENTINO - ALTO ADIGE"=>"TRENTINO - ALTO ADIGE", "UMBRIA"=>"UMBRIA", "VALLE D'AOSTA"=>"VALLE D'AOSTA", "VENETO"=>"VENETO", "ESTERO"=>"ESTERO")); $smarty->assign('reg_sel', $reg); // if (!empty($reg)) { //regione presente, compilare tabella in html if ($mitt=="") { //$stmt="SELECT concat(right(data,4),mid(data,4,2),mid(data,1,2)) as data_full, protocollo, mittente, oggetto, provincia, regione, data from prot_candidature_2014 where regione='$reg' and right(data,4)=2014"; $stmt="SELECT protocollo, mittente, oggetto, citta, regione, data from prot_candidature_2014 where regione='$reg' and right(data,4)=2014"; } else { $mitt=strtoupper($mitt); $mitt="%".$mitt."%"; //$stmt="SELECT concat(right(data,4),mid(data,4,2),mid(data,1,2)) as data_full, protocollo, mittente, oggetto, provincia, regione, data from prot_candidature_2014 where regione='$reg' and UPPER(mittente) like '$mitt' and right(data,4)=2014"; $stmt="SELECT protocollo, mittente, oggetto, citta, regione, data from prot_candidature_2014 where regione='$reg' and UPPER(mittente) like '$mitt' and right(data,4)=2014"; } $hstmt = $smarty->llp_db->execute($stmt); $n_rows=mysql_num_rows($hstmt); if ($n_rows!=0) { //mandare dati tabella $content=array(); while ($row = $smarty->llp_db->fetch_array($hstmt)) { $content[]=$row; } $smarty->assign('row',$content); $smarty->assign('full','SI'); } else { //non ci sono risultati $smarty->assign('full','NO'); } } else { $smarty->assign("vuoto","SI"); } $smarty->display('index.tpl'); ?>