lige nu ser min troels.php sådan her ud:
men skal den det?? jeg mener, der skal ikke være noget php-include el. noget?
<?php
ob_start();
/*header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");*/
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title></title>
<LINK href="
http://runehansen.dk/misc/styles_indhold_vote.css" type=text/css rel=stylesheet>
</head>
<?php
mysql_connect("localhost", "brugernavn", "kode");
mysql_select_db("databasenavn");
?>
<?
if(!$_COOKIE["stem"]) {
if($_GET[stem]) {
mysql_query("update troels set antal=antal+1 where id='$_GET[stem]'");
setcookie("stem", time()+360);
}
} else {
setcookie("stem", time()+360);
echo "Du har stemt, og kan derfor ikke stemme mere";
}
?>
<body>
<table class="indhold">
<tr>
<td>Look-A-Like?
</td>
</tr>
<tr>
<td>
<?php
$res = mysql_query("select * from troels where id=1") or die(mysql_error());
while($data = mysql_fetch_array($res)) {
?>
<a href="<? echo "$_SERVER[PHP_SELF]?stem=$data[id]";?>"><b><? echo $data[tekst];?></b></a><br>
<?
echo $data[antal] . " stemmer.<br>";
$ialt = mysql_query("select sum(antal) from troels") or die(mysql_error());
$ialt = mysql_result($ialt,0,0);
$pro = $data[antal]*100/$ialt;
echo "<div class='bag'><img src='pin.gif' height='10' width='$pro%'></div>" . round($pro,2) . "%";
}
?>
</td>
</tr>
<tr>
<td><?php
$res = mysql_query("select * from troels where id=2") or die(mysql_error());
while($data = mysql_fetch_array($res)) {
?>
<a href="<? echo "$_SERVER[PHP_SELF]?stem=$data[id]";?>"><b><? echo $data[tekst];?></b></a><br>
<?
echo $data[antal] . " stemmer.<br>";
$ialt = mysql_query("select sum(antal) from troels") or die(mysql_error());
$ialt = mysql_result($ialt,0,0);
$pro = $data[antal]*100/$ialt;
echo "<div class='bag'><img src='pin.gif' height='10' width='$pro%'></div>" . round($pro,2) . "%";
}
?>
</td>
</tr>
<tr>
<td><?php
$res = mysql_query("select * from troels where id=3") or die(mysql_error());
while($data = mysql_fetch_array($res)) {
?>
<a href="<? echo "$_SERVER[PHP_SELF]?stem=$data[id]";?>"><b><? echo $data[tekst];?></b></a><br>
<?
echo $data[antal] . " stemmer.<br>";
$ialt = mysql_query("select sum(antal) from troels") or die(mysql_error());
$ialt = mysql_result($ialt,0,0);
$pro = $data[antal]*100/$ialt;
echo "<div class='bag'><img src='pin.gif' height='10' width='$pro%'></div>" . round($pro,2) . "%<br>";
echo $ialt . " har stemt ialt";
}
?>
</td>
</tr>
</table>
<?
mysql_close();
ob_end_flush();
?>
</html>
jeg har ændret kode etc