Database Articles
  Home arrow Database Articles arrow Page 5 - Adding a Poll to Your Web Site
Codewalker Forums 
  Tutorials  
Database Articles  
Miscellaneous  
Navigation Usability  
PEAR Articles  
Programming Basics  
Server Administration  
XML Tutorials  
  Reviews  
Database Book Reviews  
Linux Book Reviews  
Miscellaneous Reviews  
PHP Book Reviews  
PHP Software Reviews  
Server Admin Reviews  
SQL Tool Reviews  
  Code Gallery  
Content Management Code  
Contest Code  
Counters Code  
Database Code  
Date Time Code  
Discussion Board Code  
Email Code  
File Manipulation Code  
GUI Code  
Link Farm Code  
Miscellaneous Code  
Search Code  
Site Navigation Code  
User Management Code  
Mobile Linux 
App Generation ROI 
IBM® developerWorks 
Download TestComplete 
Forums Sitemap 
Weekly Newsletter 
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
DATABASE ARTICLES

Adding a Poll to Your Web Site
By: Codewalkers
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 125
    2005-06-29

    Table of Contents:
  • Adding a Poll to Your Web Site
  • Setting the Stage
  • Creating the Form
  • The Complete showvotes.php
  • Expanding the Poll
  • Polling Accuracy

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    Adding a Poll to Your Web Site - Expanding the Poll


    (Page 5 of 6 )

    What if you want to create a new poll each week, or a 25-question survey, or even a trivia quiz? Simple! Create a second table, poll_questions, to hold all the questions. Add an index to poll_answers to reference the question number.

    The SQL for poll_questions might look like this:

    CREATE TABLE poll_questions
    (poll_num INT NOT NULL PRIMARY KEY,
     question VARCHAR(35) NOT NULL)

    And the new poll_answers:

    CREATE TABLE poll_answers
    (poll_num INT NOT NULL, choice INT NOT NULL,
     activity VARCHAR(35) NOT NULL, votes INT DEFAULT 0,
     PRIMARY KEY (poll_num, choice))

    You could also add date fields to poll_questions to set a starting and ending date for each question to be displayed. If you're designing a quiz, you could add a field to poll_questions to indicate which answer is correct.

    More Database Articles Articles
    More By Codewalkers


       · I've written a poll system myself and the method I use for accuracy is through...
       · I think the key word there is community. If you've already got an interactive web...
       · with the number of poll scripts already available for free on scripts site, it would...
       · Everything seems to work nicely, but the graph doesn't show at all. The vote totals...
       · Hey LadieS!
       · Great tutorial.. and I couldn't agree less with the guy who said that it'd be better...
       · Excellent tutorial. Never looked at setting up a poll for my site, but might well...
       · I personally would have thought that using the width attribute of an img tag (src...
       · Where is the content in pdf?Why is the file half done?
       · what is ferret?
       · HiOnline poll is great way . But only concern i have with Poll result. Suppose we...
     

    DATABASE ARTICLES ARTICLES

    - More on Query Optimization for Oracle Databa...
    - Query Optimization in Oracle
    - Clusters and Other Data Structures for Oracle
    - Using Indexes with an Oracle Database
    - The Basics of Data Structures in Oracle
    - Oracle Data Structures
    - Best Practices for PL/SQL Variables
    - What`s Code Without Variables?
    - Clauses, Sorting, and SQL Queries
    - The From Clause and SQL Queries
    - Query Primer
    - Full Text Searches and Strings
    - Searching with Strings
    - Pattern Matching with Strings
    - Working with Cases of Strings





    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 5 Hosted by Hostway
    Stay green...Green IT