Danke für die ausführliche Antwort vorallem von Auge.
ich habe den Code bis hier geschaft, aber trotzdem zählt er hoch beim Drucken von F5 weiter. es wäre werklich sehr nett, wenn jemand mir die stelle, wo es noch was fiehlt klären
<?
global $action;
global $Wahl;
//global $msub_Comp_ID;
global $Vote_System2;
//include("../mysqlconnect.php");
//$Owner_ID=1;
//global $Vote_System;
//$msub_Comp_ID=6;
?>
<?
//$add_to.="Nr: $Vote_System2";
//echo "nr: ".$Vote_System;
if(!isset($msub_Comp_ID) or $msub_Comp_ID==0)
{
$add_to.="Fehler in der Votebox!";
}
else
{
if($Vote_System2==$msub_Comp_ID)
{
//setcookie("Vote_System","sd",time()+12*3600);
$add_to.= "Heute schon gevotet. Erst in 24 Stunden wieder!";
$showvote=1;
}
?>
<?
//ab hier kann das Fehler liegen
if(!isset($action) and !isset($showvote))
{
$sql="SELECT * FROM voting_frage where frage_ID=$msub_Comp_ID";
if(!$ergebnis=mysql_query($sql))
{
$add_to.= mysql_errno()." : ".mysql_error();
}
while($entry=mysql_fetch_object($ergebnis,MYSQL_ASSOC))
{
// die Umfrage klingt deutlicher in einer Tabelle
$add_to.= "<table style='background-color:#0000FF' border ='0' width='100%' height='100%'><tr><td align=left>". "<b style ='color:#FFFFFF'>".$entry->Frage."</b>"."</td></tr>";
}
$sql="SELECT * FROM voting_antworten where frage_ID=$msub_Comp_ID";
if(!$ergebnis=mysql_query($sql))
{
$add_to.= mysql_errno()." : ".mysql_error();
exit();
}
$add_to.="<b style ='color:#FF0000'> Unsere aktulle Umfrage für Sie!! </b>";
$add_to.= "<form method=get action=''>";
while($entry=mysql_fetch_object($ergebnis,MYSQL_ASSOC))
{
//$Antwort = $entry->Antwort;
$add_to.= "<table style='background-color:#0000FF' border ='0' width='100%'><tr><td align=left><input type=radio name=Wahl value='$entry->Ant_ID'></td><td style ='color:#FFFFFF' align=left >$entry->Antwort</td></tr>";
//setcookie("Ant",$entry->Antwort,time()+5);
}
$add_to.= "<tr><td><input type=hidden name=action value=add> </td><td><input type=submit value=OK></td></tr>";
$add_to.= "</table><input type=hidden name=level value=$level><input type=hidden name=Top_ID value=$Top_ID><input type=hidden name=ID value=$ID></form>";
}
else if($action=="add")
{
// die Wahl darf nciht mehr als 3 Sekunden gewählt
// if (isset($Wahl) or $Wahl!="") { setcookie("wahl",$Wahl,time()+5);}
if(!isset($Wahl) or $Wahl=="")
{
$add_to.="Sie haben nichts ausgewählt.<a href='javascript:history.back();'>Zurück</a>";
}
else
{
$sql="SELECT Ergebnis FROM voting_antworten where Ant_ID=$Wahl";
if(!$ergebnis=mysql_query($sql))
{
$add_to.= mysql_errno()." : ".mysql_error();
}
$wert=1;
if($entry=mysql_fetch_object($ergebnis,MYSQL_ASSOC))
{
$wert=$wert+$entry->Ergebnis;
}
//ab hier besser aufpassen
$sql="Update voting_antworten Set Ergebnis=$wert where Ant_ID=$Wahl";
if(!$ergebnis=mysql_query($sql))
{
$add_to.= mysql_errno()." : ".mysql_error();
}
//setcookie("Vote_System",$msub_Comp_ID,time()+5);
$Vote_System2=$msub_Comp_ID;
//$add_to.= $Vote_System;
$add_to.= "<table style='background-color:#0000FF' border ='0' width='100%' height='100%'><tr><td align=left>". "<b style ='color:#FFFFFF'>" ."Sie haben Ihre Stimme abgegeben!</b>"."</td></tr>";
$showvote=1;
}
}
if(isset($showvote) and $showvote==1)
{
$sql="SELECT * FROM voting_antworten where frage_ID=$msub_Comp_ID";
if(!$ergebnis=mysql_query($sql))
{
$add_to.= mysql_errno()." : ".mysql_error();
}
$total=0;
while($entry=mysql_fetch_object($ergebnis,MYSQL_ASSOC))
{
$total=$total+$entry->Ergebnis;
}
$sql="SELECT * FROM voting_antworten where frage_ID=$msub_Comp_ID";
if(!$ergebnis=mysql_query($sql))
{
$add_to.= mysql_errno()." : ".mysql_error();
exit();
}
$anz_ant=0;
//$total=mysql_num_rows($ergebnis);
$add_to.= "<br>";
if($total==0) $total=1;
while($entry=mysql_fetch_object($ergebnis,MYSQL_ASSOC))
{
$anz_ant++;
$pro_erg=100*$entry->Ergebnis/$total;
$pro_erg=round($pro_erg);
$pro_erg_gr=(int) ($pro_erg/2);
$add_to.= "<table width=100%><tr><td width=50 align='left'><img src='http://www.saarsportvereine.de/content_01/systemdesign/vote_farb_".(($anz_ant % 5)+1).".jpg' width='$pro_erg_gr' height='15'></td><td width=40 align='left'>$entry->Antwort </td><td width=10>".$pro_erg."% ($entry->Ergebnis)</td></tr></table>";
}
$add_to.= " <input type='submit' name='zurueck' value='zurück' OnClick='javascript:history.back();'>";
}
}
schöne Grüße
muga