vorrei sapere perchè ho il seguente errore:
Warning: Cannot modify header information - headers already sent by (output started at C:\Programmi\Apache Software Foundation\Apache2.2\htdocs\config.php:8) in C:\Programmi\Apache Software Foundation\Apache2.2\htdocs\funzioni.php on line 20.
il file in questione è:
il file funzioni.php è:
Warning: Cannot modify header information - headers already sent by (output started at C:\Programmi\Apache Software Foundation\Apache2.2\htdocs\config.php:8) in C:\Programmi\Apache Software Foundation\Apache2.2\htdocs\funzioni.php on line 20.
il file in questione è:
PHP:
<?php
require 'funzioni.php';
require 'config.php';
$link=mysqli_connect(HOSTNAME,USERNAME,PASSWORD,DATABASE) or mysqli_showerror();
if ($_POST['data']!='')
$data="'$_POST[data]'";
else
$data="now()";
mysqli_query($link,"insert into voli values (null,'$_POST[numaereo]','$_POST[idsrc]','$_POST[iddst]',$data)") or mysqli_showerror($link);
$id=mysqli_insert_id($link);
redirect_browser("inserimento2-conferma.php?id=$id");
?>
il file funzioni.php è:
PHP:
<?php
function mysqli_showerror($link=null) {
if (is_null($link))
$message=mysqli_connect_errno().' : '.mysqli_connect_error();
else
$message=mysqli_errno($link).' : '.mysqli_error($link);
$bt=debug_backtrace();
die("<strong>MySQL Error</strong>: $message in file <strong>{$bt[0]['file']}</strong> on line <strong>{$bt[0]['line']}</strong>");
}
function redirect_browser($url)
{
if (strncmp('http:',$url,5) && strncmp('https:',$url,6)) {
$starturl = (isset($_SERVER["HTTPS"]) ? 'https' : 'http') . '://'.
(isset($_SERVER['HTTP_HOST'])? $_SERVER['HTTP_HOST'] :
$_SERVER['SERVER_NAME']);
if ($url[0] != '/') $starturl .= dirname($_SERVER['PHP_SELF']).'/';
$url = $starturl.$url;
}
header("Location: $url");
}
?>