View Full Version : ...nothing happens... at all

07-12-2005, 02:18 PM
I just converted this simple poll script from text file to mSQL database driven so I've probably bodged it up somewhere but nothing happens, at all, no errors, just nothing, the source code is empty... even if the variables were all empty at least the basic HTML should be there...
I'm stumped, error messages I can fix - but I'm getting nothing.

$strSQL = "SELECT * FROM Questions WHERE Active = 1";
$question = mysql_fetch_array(mysql_query($strSQL)) or die(mysql_error());
//register vote.
$strSQL = "SELECT * FROM Poll WHERE QuestionID = ".$question['ID'];
$result=mysql_query($strSQL)or die(mysql_error());

$num_fields = mysql_num_fields($result);
$name = mysql_field_name($result, $j);

$vote = $_GET['PollVote'];
$filestring = "";
$totalvotes = 0;

$answers[$vote]['Votes'] = $answers[$vote]['Votes']+1;
foreach($answers[]['Votes'] as $result){
$totalvotes =$totalvotes +$result;
$strSQL = "UPDATE Poll SET Votes = Votes+1 WHERE ID = ".$answers[0]['ID']+$vote;

$_SESSION['voted'] = true;
$_SESSION['votes'] = $totalvotes;


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Poll Results</title>
<link href="css/common.css" rel="stylesheet" type="text/css" />

<div style = "border:1px solid #53217E; padding-bottom:5px;">
<img src="images/smallbanner.gif" />
<table align = "center" bgcolor="#8F74AB" width = "288" style="color:#FFFFFF; font-weight:bold;" >
echo "<tr><td colspan = \"3\">$question</td></tr>";
$totalvotes = $_SESSION['votes'];
for($i = 0; $i<count($answers); $i++)
$percent = intval(($answers[$i]['Votes']/$totalvotes)*100);
$width = $percent;
$result = trim($results[$i],"\n");
echo "<tr height =\"20\" valign = \"middle\"><td>$answers[$i]['Answer']</td><td width = \"110\"> <img src = \"images/poll.gif\" width = \"$width\" height = \"10\" style =\"border:1px solid #4B256C\" /></td><td>$percent%</td></tr>\n";
echo "<tr><td></td><td></td><td>$totalvotes votes</td></tr>";


07-12-2005, 02:37 PM
Ignore me, I'm being an idiot...

anyone else in the UK cant think in this heat?!

07-12-2005, 03:02 PM
Nup, t'is awful. I wouldn't mind the heat if I was on the beach but it's no fun in the office :cool:

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum