/*
$news = array(
"Lezioni"=>array("lezione prof 1","lezione prof 2" ),
"Esami"=>array("esame prof 1","esame prof 2","esame prof 2","esame prof 2","esame prof 2","esame prof 2","esame prof 2" ),
"Altro"=>array("prova news1","prova news2")
);
*/
//include_once "ez_sql.php";
require_once( 'localContext.php' ); // automatically includes global_config.php
require_once( CONTEXT_PATH . 'classi_php/DBManager.class.php' ); // defined in localContext.php
//$db = new db("innamorati","56cappa","facolta","192.168.142.15");
//$news_raw = $db->get_results($sql, ARRAY_A);
//print_r($news_raw);
$gestoreDB = new DBManager( 'facolta' );
$connessione =& $gestoreDB->getConnessione();
//echo "VIS: $vis
";
$query="SELECT news.id, titolo, dataInserimento, dataScadenza, descrizione FROM news,tiponews WHERE ".$vis."=1 AND news.tiponews=tiponews.tiponews AND datascadenza > '".date("Y-m-d")."' ORDER BY dataInserimento desc";
//echo $query."
";
$statement = $connessione->prepare($query);
$res = $connessione->execute( $statement );
//print_r($res);
if (PEAR::isError($res))
die($res->getMessage());
$buff = $res->fetchInto($notizia, DB_FETCHMODE_ASSOC);
$catp = $buff["descrizione"]; //$news_raw[0]["descrizione"];
//foreach($news_raw as $n=>$rec){
while($res->fetchInto($rec, DB_FETCHMODE_ASSOC)){
//echo $rec["descrizione"]."
";
if ($catp != $rec["descrizione"]){
$news[$catp] = $cat;
$catp = $rec["descrizione"];
$cat = array();
}
$cat[] = array( "id"=>$rec["id"],"titolo"=>$rec["dataInserimento"]."
".$rec["titolo"]);
}
$news[$catp] = $cat;
//print_r($news);
?>