Ciao a tutti... ho un problema: ho il seguente script:
Codice PHP:
<?php
include('./guestbook2/includes/config.inc.php');
include('./guestbook2/includes/functions.inc.php');
include('./guestbook2/includes/database_connect.inc.php');
function getCOL($myFILE, $row, $arg) { // $row->row; $arg=""->whole line, $arg=2->get arg 2
$content = file($myFILE); // read file
if($arg == ""):
return $content[$row];
break;
else:
$myLINE = explode("|",$content[$row-1]);
return $myLINE[$arg];
endif;
}
function evalMAXid($file){
global $id;
$content = file($file);
$size = count($content);
$maxID = 0;
for($line=1; $line<=$size; $line++):
$tmpID = getCOL($file, $line, "0");
if($tmpID > $maxID) { $maxID = $tmpID; }
endfor;
return $maxID;
}
$size = count($content);
$max = evalMAXid('./data.txt');
$content = fopen('./data.txt', 'r');
for ($i=0; $i<$max; $i++) {
$text = explode("|",$content[$size-$i-1]);
$sql = "INSERT INTO $conf[dbt_gbook] (ID, nome, commento, mail, url, data, pubblica) VALUES ('$text[0]', '$text[2]', '$text[7]', '$text[3]', '$text[6]', '$text[1]', 'si')";
if (mysql_query($sql, $db)) {
echo "OK";
} else {
echo mysql_error();
}
?>
</body>
</html>
che dovrebbe aprire un file .txt (data.txt) e con delle query inserire alcuni dei dati in esso contenuti su u ndtabase.
solo che il risultato è una pagina completamente bianca, senza intestazione o altro...
Perchè non funziona? Grazie a chi vorrà aiutarmi