codice:
<?php

include("dbconnect2.php");

$err="";

$filename = file("agg-dati.sql");
foreach($filename as $valore)
{
	$select = $valore;
	if (!mysql_query($select)){
		$err.="
\n ".$valore." : ".mysql_error();
		continue;
	}
}

echo "Lista errori: {$err}";
?>
così sembra andare bene...

grazie ad entrambi cmq


@13manuel84:

perchè hai messo

codice:
$select = $valore;
?

l'ho tolto mettendo direttamente

codice:
if (!mysql_query($valore)){