Jump to content

Headers error


Gruzin

Recommended Posts

Hi guys, I know it sounds dumb, but I can not get rid of this damn header error:

 

<?php
require ('config.php');

if(!isset($_COOKIE['user'])){
$user = $_SERVER['REMOTE_ADDR'];
$date = date('m-Y');
$sql = mysql_query("INSERT INTO `aid_counter` (`user`, `date`, `id`) VALUES ('$user', '$date', NULL);");

setcookie("user",$user,time()+2678400); // 1 month
}
?>

 

This is a simple counter script wich I want to include somewhere , but I recieve the following error:

 

Warning: Cannot modify header information - headers already sent by (output started at /www/cida.ge/doc/index.php:42) in /www/cida.ge/doc/admin/counter.php on line 9

 

Thanks for any help,

george

Link to comment
https://forums.phpfreaks.com/topic/37751-headers-error/
Share on other sites

Thanks Orio,

 

here is my config.php:

 

<?php
// database connection
$con = mysql_connect("localhost","XXX","XXX");
if(!$con){
  die('Error:'.mysql_error());
  }
$db = mysql_select_db("cida_ge",$con);
if(!$db){
  die('Could not select database:'.mysql_error());
  }
$u = "http://www.cida.ge"; // edit your domain here, without backslash
?>

Link to comment
https://forums.phpfreaks.com/topic/37751-headers-error/#findComment-180655
Share on other sites

headers already sent by (output started at /www/cida.ge/doc/index.php:42

 

What is line 42?

 

<link href="css/style.css" rel="stylesheet" type="text/css">

 

line 42 is not php...

 

remove the linebreak spaces whatever after the ?> in ALLL INCLUDES and REQUIRES

 

What do u mean by that?

Link to comment
https://forums.phpfreaks.com/topic/37751-headers-error/#findComment-180720
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.