Php+mysql implementation of a simple voting system instance, MySQL voting system _php Tutorial

Source: Internet
Author: User

Php+mysql implementation of a simple voting system example, MySQL voting system


This paper describes the simple voting system implemented by Php+mysql. Share to everyone for your reference, as follows:

<title>Mobile Phone system Questionnaire</title>What is the system of the mobile phone you are using now?Current number of votes:
<?phpinclude ' connect.php '; $sql = "Select answer from Countone"; $rs =mysql_query ($sql); $total =mysql_num_rows ($rs); $sql = "SELECT * from Countone where answer=1"; $rs =mysql_query ($sql), $android =mysql_num_rows ($rs); $sql = "SELECT * FROM Countone where answer=2 "; $rs =mysql_query ($sql); $symbian =mysql_num_rows ($rs); $sql =" SELECT * from Countone where answer =3 "; $rs =mysql_query ($sql); $iphone =mysql_num_rows ($rs); $sql =" SELECT * from Countone where answer=4 "; $rs =mysql_query ( $sql), $google =mysql_num_rows ($rs), $sql = "SELECT * from Countone where answer=5"; $rs =mysql_query ($sql); $winphone Mysql_num_rows ($rs); $sql = "SELECT * from Countone where answer=6"; $rs =mysql_query ($sql); $other =mysql_num_rows ($rs);? >
android Symbian iphone Google wi Nphone Other
<?php echo $android?> tickets <?php echo $symbian?> Tickets <?php echo $iphone?> tickets <?php echo $google?> tickets <?php echo $winphone? & GT, ticket <?php Echo $other?> ticket
<?php for ($i =1; $i <= $android/$total +1; $i = $i + 0.1) {echo "";}? <?php for ($i =1; $i <= $symbian/$total +1; $i = $i +0.1) {echo "";}? <?php for ($i =1; $i <= $iphone/$total +1; $i = $i +0.1) {echo "";}? <?php for ($i =1; $i <= $google/$total +1; $i = $i +0.1) {echo "";}? <?php for ($i =1; $i <= $winphone/$total +1; $i = $i +0.1) {echo "";}? <?php for ($i =1; $i <= $other/$total +1; $i = $i +0.1) {echo "";}?

It's a little verbose, a little clumsy, but practical.

<?phpinclude ' connect.php '; $name =$_post[' phone '; $sql = "INSERT into countone values (null, $name, now (), null)"; mysql_query ($sql);? >

Link MySQL:

<?phpmysql_connect ("localhost", "root", "" "); mysql_select_db (" vote "); mysql_query (" Set names UTF8 ");? >

More readers interested in PHP related content can view the topic: "PHP Primer for Object-oriented programming", "PHP String Usage Summary", "Php+mysql Database Operations Primer" and "PHP common database Operation Skills Summary"

I hope this article is helpful to you in PHP programming.

Articles you may be interested in:

    • Php+mysql Voting system design and implementation sharing
    • Analysis of the judging process of anti-brush ticket in PHP voting system
    • Php+redis implementing methods to add processing votes
    • Php+ajax method of implementing voting function
    • Implementation of red-blue (top-stepping) voting code based on Php+jquery+mysql
    • PHP combined with jquery to achieve red and blue voting function effects
    • A simple PHP voting program source code

http://www.bkjia.com/PHPjc/1104340.html www.bkjia.com true http://www.bkjia.com/PHPjc/1104340.html techarticle Php+mysql Implementation of a simple voting system example, MySQL voting system This paper describes the Php+mysql implementation of the simple voting system. Share to everyone for your reference, as follows: HtmlHead ...

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.