I noticed that Message-ID: <Km************ **********@news .easynews.com>
from Neal contained the following:
yes.....someth ing like that. My results are stored in MySQL database
with fields qone, qtwo, qthree, etc...
Each question has 6 possible answers / values ranging from Excellent to
Unsatisfactory . Can I see your source code?
Because this is designed to be re-used for all sorts of different votes,
I store the choices as a comma separated list in the ballot table, but
of course there is only one question. Anyway, if it helps, see below
for the relevant bit of code. Looking through it, I think the html is a
little screwed, but it works and the only thing the validator picks up
is missing alt attributes on the .gifs used for the bars..
....
$ballotid=$_GET['ballotid'];
$db = @mysql_connect( "server", "user", "password") or
die("Could not connect: " . mysql_error()); ;
mysql_select_db ("database_name ",$db);
$sql="SELECT * from ballot WHERE ballotid='$ball otid' AND
end_date>now()" ;
$result = mysql_query($sq l);
$vote_finished = mysql_num_rows( $result);
$sql="SELECT * from ballot,vote,vot er WHERE ballot.ballotid ='$ballotid'
AND ballot.ballotid =vote.ballotid and voter.voterid=v ote.voterid AND
vote.confirmed= 'Yes'AND (status is null OR status='OK')";
$result = mysql_query($sq l);
$totalrows = mysql_num_rows( $result);
$myrow = mysql_fetch_arr ay($result);
?>
<body bgcolor="#FFFFF F" text="#000000">
<h1 align="center"> GB Voting </h1>
<h2 align="center"> Welcome to the results page</h2>
<h2 align="center"> The issue in question is:</h2>
<h1 align="center"> <?php print $myrow['description']; ?></h1>
if($vote_finish ed>0){
print"<h3 align=\"center\ "><a href=\"vote.php ?$ballotid\">Vo te still
running</a></h3>";
$result = mysql_query("SE LECT UNIX_TIMESTAMP( end_date) AS unixdate FROM
ballot WHERE ballotid='$_GET[ballotid]'" ,$db);
$myrow = mysql_fetch_arr ay($result);
$RealDate = date("F jS, Y", $myrow["unixdate"]);
print "<h1 align=\"center\ " class=\red\">Re sults available on
$RealDate</h1></body></html>";
exit;
}
?>
<h3 align="center"> Only confirmed votes (<?php print $totalrows; ?>) are
counted</h3>
<?php
//summary
$choices= explode(",", $myrow['choices']);
if($totalrows>0 ){
print"<hr size=\"1\" width=\"90%\">< table width=\"75%\" border=\"0\"
cellspacing=\"0 \" cellpadding=\"3 \" align=\"center\ ">";
for ($i=1;$i<count( $choices); $i++){
$picked=trim(ad dslashes($choic es[$i]));
$sql="SELECT * from vote WHERE choice='$picked ' AND confirmed='Yes' AND
ballotid='$_GET[ballotid]'AND (status is null OR status='OK')";
$result = mysql_query($sq l);
$numrows=mysql_ numrows($result );
$percent=number _format(($numro ws*100/$totalrows),1);
print "<tr>
<td width=\"39%\"al ign=\"right\">< b>$choices[$i]</b></td>
<td width=\"21%\">& nbsp;= <b>$numrows</b> ($percent%)</td>
<td width=\"40%\">< table width=\"100%\" border=\"0\"
cellspacing=\"0 \" cellpadding=\"0 \">
<tr>
<td class=\"border\ "><img src=\"redline.g if\" width=\"$percen t%\"
height=\"3\"></td>
</tr>
</table></td>
</tr>";
}
print "</table>";
//end summary
--
Geoff Berrow (put thecat out to email)
It's only Usenet, no one dies.
My opinions, not the committee's, mine.
Simple RFDs
http://www.ckdog.co.uk/rfdmaker/