Jump to content

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.