false, PDO::ATTR_ERRMODE=>PDO::ERRMODE_EXCEPTION));
$sql = "use $dbname";
$dbi->exec($sql);
}
catch(PDOException $e)
{
echo $sql . "
" . $e->getMessage();
}
$lines = file('./inc/sql/db.sql');
$tabko = array();
$x=0;
$y=0;
foreach ($lines as $line_num => $line) {
if(!$x) {
# $len=strlen($line)-2;
$line=chop($line);
$nometab = $prefix.substr($line, 1,-1);#echo "LINE: $nometab -- x: $x --
";
$x=1;
continue;
}elseif(!$y){
$elenco=explode(",", $line);
$y=1;
$x=0;
continue;
}else{
$x=0;
$sql="SELECT COLUMN_NAME FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_SCHEMA = '$dbname' AND TABLE_NAME = '$nometab'";
$rest = $dbi->prepare("$sql");
$rest->execute(); #echo "SQL: $sql";
$line=chop($line); #elimina spazi in fondo alla stringa
$remcampi=explode(",", $line);
$campi=count($remcampi);
$loccampip=$rest->fetchAll();
$loccampi=array();
foreach($loccampip as $z=>$loc) array_push($loccampi,$loc[0]);
$ctrloc=array();
$ctrloc=array_diff($remcampi,$loccampi);
$ctrrem=array_diff($loccampi,$remcampi);
if(count($ctrloc) or count($ctrrem)) {$divcolor="red"; $u=1;} else {$divcolor="green"; $u=0;}
echo "Controllo Tabella: $nometab
";
foreach($ctrloc as $z=>$loc) echo "