Have an account? Sign in
Login  Register  Facebook
Poll Tutorial reading the database but not storing the result of vote
Hi there,

I'm trying to work with the following tutorial
http://www.awcore.com/dev/2/2/jquery-dynamic-poll-with-animated-colors_en

I got the database set up and it's displaying on my page but when I click to vote, the result isn't being stored and the display changes doesn't show the voting results and the percentage number at the end is displayed as an empty box. Please Help

<!DOCTYPE html>
<!--[if IE 8]> <html lang="en" class="ie8 no-js"> <![endif]-->
<!--[if IE 9]> <html lang="en" class="ie9 no-js"> <![endif]-->
<!--[if !IE]><!-->
		<?php
	//Include database connection details
	include('config.php');
	//Connect to mysql server
	$mysql = mysql_connect(DB_HOST, DB_USER, DB_PASSWORD, DB_DATABASE);
	if(!$mysql) {
		die('Failed to connect to server: ' . mysql_error());
	}
	mysql_select_db("descent", $mysql) or die( "Unable to select database" .  mysql_error());
	include_once ('functions.php');
    $id = (isset($_GET['id'])) ? intval($_GET['id']) : 1;
    if(!$row = get_poll($id)){
        exit('not found');
    } 
?>
<html lang="en">
<!--<![endif]-->
<!-- BEGIN HEAD -->
<head>
<meta charset="utf-8" />
<title>Descent Naughty or Nice 2014 Setlist</title>
<meta content="width=device-width, initial-scale=1.0" name="viewport" />
<meta name="description"  content="Vancouver nightlife would not be complete without the best place to hear Goth, Industrial, EBM, Techno, Metal, and Rock.  Check out what we've played"/>
<meta name="keywords" content="Descent, Music, Set list, VNV Nation, Combichrist, Covenant">
<meta name="author"  content="Descent Sundays"/>
<meta name="MobileOptimized" content="320">
<!--srart theme style -->
<link href="../css/main.css" rel="stylesheet" type="text/css"/>
<link rel="stylesheet" id="theme-color" type="text/css" href="#"/>
<link rel="stylesheet" id="theme-pattern" type="text/css" href="#"/>
<!-- end theme style -->
<!-- poll files start -->
    <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.5/jquery.min.js"></script>
    <script type="text/javascript" src="../polls/awcore.polls.js"></script>
    <!-- delete this if you have the jquery ui -->
<script type="text/javascript" src="../backgroundColor.js"></script>
    <link href="../polls/polls.css" rel="stylesheet" type="text/css" />
<!-- poll files end -->	
<link rel="shortcut icon" href="favicon.png" />
<?php include('../../analytics.php');?>
</head>
<!--body start-->
<body>
<!--header start-->
<header id="rock_header_otherpage">
<?php include('../../nav.php');?>
</header>
<!--header end--> 
<!--page title start-->
<div class="rock_page_title_main">
  <div class="rock_page_title_bg">
    <section class="main">
      <div id="rock_page_title_bg" class="ri-grid ri-grid-size-3">
<?php include('../../slider-back.php');?>
      </div>
    </section>
  </div>
  <div class="rock_page_title">
    <div class="container">
      <div class="rock_heading_div">
        <div class="rock_heading">
          <h1>December 21 - Naughty or Nice</h1>
          <p>X</p>
        </div>
      </div>
    </div>
  </div>
</div>
<!--page title end-->
<div class="clearfix"></div>
<div class="container">
<div class="col-lg-8 col-md-8 col-sm-7">
  <div class="row">
      <div class="col-lg-12">
        <div class="rock_blog_single">
<table border="0" cellspacing="20" cellpadding="1">
<tr><td class="col-lg-3">
<h3>Spaz</h3><br /><img src="../spaz-thumb.jpg" alt="DJ Spaz" /><br>
<i>Resident DJ</i><br>
<script language="JavaScript" src="/player/audio-player.js"></script> 
<object type="application/x-shockwave-flash" data="/player/player.swf" id="audioplayer2" height="24" width="190"> 
<param name="movie" value="/player/player.swf"> 
<param name="FlashVars" value="playerID=audioplayer2&soundFile=/player/2014/Dec21-14-Set-1(Spaz).mp3"> 
<param name="quality" value="high"> 
<param name="menu" value="false"> 
<param name="wmode" value="transparent"> 
</object>
</td><td class="col-lg-6">
DJ://Spaz was having way too much fun to write down his set!  He started the night off with a bang!  Curious about what he played?  Listen to it on the left or harass him to write his sets down.  He did write down the following <br>
<ol>
<li>deadmau5 - acedia</li>
</ol>
<p>&nbsp;</p></td></tr>

<tr><td class="col-lg-3">
<h3>Surreal</h3><br />
<img src="../images/Surreal-thumb.jpg" alt="DJ Surreal" /><br />
<i>Resident DJ</i><br>
<script language="JavaScript" src="/player/audio-player.js"></script> 
<object type="application/x-shockwave-flash" data="/player/player.swf" id="audioplayer2" height="24" width="190"> 
<param name="movie" value="/player/player.swf"> 
<param name="FlashVars" value="playerID=audioplayer2&soundFile=/player/2014/Dec21-14-Set-2(Surreal).mp3"> 
<param name="quality" value="high"> 
<param name="menu" value="false"> 
<param name="wmode" value="transparent"> 
</object>
</td><td class="col-lg-6">
DJ Surreal was next to play and she kept the dance floor buzzing.  Read her set below or listen to it on the left.<br>
<ol>
<li>Combichrist - Give Head if You Got It</li>
<li>Aesthetic Perfection - Spit it Out</li>
<li>Destroid - Friend of Foe</li>
<li>Inner Party System - American Trash</li>
<li>And One - Wasted</li>
<li>Scissor Sisters - Filthy/Gorgeous</li>
<li>Royskopp - What Else is There? (Trentmoller Remix)</li>
<li>Pendulum - Fasten Your Seatbelts</li>
<li>She Wants Revenge - Kidnap the Sandy Claws</li>
<li>VNV Nation - Epicenter</li>
<li>My Life with the Thrill Kill Kult - After the Flesh</li>
<li>MSI - Never Wanted to Dance (Remix)</li>
<li>Puscifer - The Undertaker (Renholder Mix)</li>
<li>Repo! The Genetic Opera - Zydrate Anatomy</li>
<li>Manson - I put a Spell on You</li>
<li>Rammstein - Stripped</li></ol>
<p>&nbsp;</p></td></tr>

<tr><td class="col-lg-3"><h3>NEro</h3><br><img src="../images/joshy-thumb.jpg" alt="DJ NEro" /><br>
<i>Resident DJ</i><br>
<script language="JavaScript" src="/player/audio-player.js"></script> 
<object type="application/x-shockwave-flash" data="/player/player.swf" id="audioplayer2" height="24" width="190"> 
<param name="movie" value="/player/player.swf"> 
<param name="FlashVars" value="playerID=audioplayer2&soundFile=/player/2014/Dec21-14-Set-3(Nero).mp3"> 
<param name="quality" value="high"> 
<param name="menu" value="false"> 
<param name="wmode" value="transparent"> 
</object>
</td><td class="col-lg-6">
DJ NEro took over the 3rd spot of the evening.  He carried on the awesome energy of our winter celebration.  Read his set below or listen to it on the left.<br>
<ol>
<li>bloodhound gang - bad touch</li>
<li>scissor sisters - the skins</li>
<li>fisherspooner - infidels something or other</li>
<li>kmfdm - looking for strange</li>
<li>depeche mode - personal jesus</li>
<li>thd - violence</li>
<li>the prodigy - warriors dance</li>
<li>front 242 - untill death us do part</li>
<li>joshy neurotic mix - TERORHAM !!!</li>
<li>nin - head like a hole</li>
<li>combichrist - this shit WILL INDEED fuck you up</li>
<li>the birthday massacre - horror show</li>
<li>skinny puppy - testure</li>
<li>kmfdm - bait and switch</li>
<li>spetsnaz - on the edge</li>
<li>call the shis to port</li>
<li>fla - plasticity</li></ol>
<p>&nbsp;</p></td></tr>
<tr><td class="col-lg-3"><h3>Mori</h3><br><img src="../images/mori-thumb.jpg" alt="DJ Mori" /><br>
<i>Resident DJ</i><br>
<script language="JavaScript" src="/player/audio-player.js"></script> 
<object type="application/x-shockwave-flash" data="/player/player.swf" id="audioplayer2" height="24" width="190"> 
<param name="movie" value="/player/player.swf"> 
<param name="FlashVars" value="playerID=audioplayer2&soundFile=/player/2014/Dec21-14-Set-4(Mori).mp3"> 
<param name="quality" value="high"> 
<param name="menu" value="false"> 
<param name="wmode" value="transparent"> 
</object>
</td><td class="col-lg-6">
DJ Mori closed out the 2014 Naughty or Nice with a packed dancefloor till the last song!  Check out her set or listen to it on the left.<br>
<ol>
<li>Tear you Apart - She Wants Revenge</li>
<li>Panzermensch - And One</li>
<li>All Hallow’s Eve - Skull Kid</li>
<li>Asche zu Asche - Blutengel</li>
<li>Heaven Knows - The Pretty Reckless</li>
<li>Not in Love - Crystal Castles ft Robert Smith</li>
<li>You Can Not Beat Me! - DJ Pher8 vs Massive Aggression Syndrome</li>
<li>Coming Undone - Korn (Acid Planet Remix 2)</li>
<li>Retaliate - VNV Nation</li>
<li>The Lunatics Have Taken Over the Asylum - Collide</li>
<li>The Devil is in the Beat - Chemical Brothers</li>
<li>Wreath of Barbs - Wumpscut</li>
<li>It’s No Good - Depeche Mode</li>
<li>Ein Kleiner Mensch - T.A.T.U. vs Rammstein</li>
<li>Straight to Video - MSI (Combichrist Remix)</li>
<li>Light the Way (Back Home) - Rogue/The Crüxshadows</li></ol>
<p>&nbsp;</p></td></tr>
</table> 
<center>
<div id="<?php echo $row['poll_id'];?>" class="polls">
    <h2><?php echo $row['title'];?></h2>
	<form <?php if(get_votes($row['poll_id'])){ echo 'class="closed"';}?> method="post">
    
        <?php
            foreach (poll_options($id) as $option) {
        ?>    
        	<p id="option_<?php echo $option['id'];?>" class="rounded dark_shadow">
        		<span class="option rounded dark_shadow" style="width:<?php echo $option['percent'];?>%;" title="<?php echo $option['percent'];?>"></span>
        		<input id="<?php echo $option['id'];?>" name="vote" value="<?php echo $option['id'];?>" type="radio" />
        		<label for="<?php echo $option['id'];?>"><?php echo $option['title'];?></label>
        		<em><?php echo $option['percent'];?>%</em>
        	</p>   			
        <?php    	
            }			
        ?>    

	</form>
</div>
</center>   
        </div>
      </div>
  </div>
    </div>
    <!--sidebar start-->
	  <div class="col-lg-4 col-md-4 col-sm-5 blogcategory_small_part">
    <div class="row">
      <div class="col-lg-12 col-md-12 col-sm-12">
        <div class="rock_sidebar">
<?php include('../../sidebar.php');?>
</div></div></div></div>
  <!--sidebar end--> 
  </div>
<br>
<div class="rock_margin_30"></div>
<div class="clearfix"></div>
    <div class="rock_copyright">
      <div class="rock_copyright_bg">
        <section class="main">
          <div id="ri-grid2" class="ri-grid ri-grid-size-3">
<?php include('../../slider-back.php');?>
          </div>
        </section>
      </div>
<div class="rock_copyright_div">
 <?php include('../../footer1.php');?></div>
</body>
<!--body end-->
</html>
Started: January 9, 2015 Latest Activity: January 9, 2015 polls
Your Answer

xDo you want to answer this question? Please login or create an account to post your answer