Kode:
<?
$dato = date("d/n-y");
$result = mysql_query("select * from zombie_taeller where dato = '$dato'") or die (mysql_error());
$row = mysql_fetch_array($result);
$number = mysql_num_rows($result);
if ($number > 0) {
if ($_COOKIE["idag"] == "") {
$query = mysql_query("select idag from zombie_taeller where dato = '$dato'") or die (mysql_error());
$row = mysql_fetch_array($query);
$hitsdag = $row["idag"];
$hitsdag++;
mysql_query("update zombie_taeller set idag = '$hitsdag' where dato = '$dato'") or die (mysql_error());
setcookie ("idag", "ok", time() + 800);
}
$query = mysql_query("select idag from zombie_taeller where dato = '$dato'") or die (mysql_error());
$row = mysql_fetch_array($query);
echo "<tr>
<td class=\\"menu\\">// <strong>Besøg Idag:</strong> $row[idag]</td>
</tr>";
} else {
$create = mysql_query("insert into zombie_taeller (dato) values ('$dato')") or die(mysql_error());
echo "<META HTTP-EQUIV=\\"refresh\\" CONTENT=\\"0;url=index.php\\">";
}
?>
Hvad er der galt med cookie? jeg får denne fejl:
Warning: Cannot add header information - headers already sent by (output started at /customers/gakgak.net/gakgak.net/httpd.www/zombienation/index.php:10) in /customers/gakgak.net/gakgak.net/httpd.www/zombienation/index.php on line 230
dvs her: setcookie ("idag", "ok", time() + 800);
Hvad er fejlen? på forhånd tak