Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New Coder
    Join Date
    Feb 2004
    Location
    Salem, Massachusetts. USA
    Posts
    48
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question PHP Voting Thing

    My goal is to make a Medal Voting page for my clan members on our site.
    I want it to do these things...

    1)Take the information. (The Person who voted, The member they voted for, and the medal they think the member should get) From the "Start New Vote" page. Did It all ready.
    2)I want to connect to a MySQL database and add the member and start a vote for the medal.

    3)Display all the current votes and a Yes or No input type whether they should get the Medal or not. (for the other people) Like a "voting pole".
    4)Check to make sure that the Session User (<?php strtolower($_SESSION['user']); ?>) hasn't voted in the particular vote before.
    5)Then expire the pole after 7 days. And Freeze it. (to be deleted by the admin on the page with a "Delete button").

    This is hard for me because I have never Deleted or Added anything to a MySQL database using the PHP. I've only done it manually.

    This is what I have so far...
    PHP Code:
    <?php
    if ($REQUEST_METHOD == 'POST') {
      
    $the_voter $_REQUEST['voter'] ;
      
    $voted_member $_REQUEST['member'] ;
      
    $voted_medal $_REQUEST['medal'] ;

    if (empty(
    $the_voter) || empty($voted_member) || empty($voted_medal)){
        
    header"Location: error.html" );
    }
    else{

    //Other Data Goes Here
    }
    }
    ?>

  • #2
    Senior Coder Nightfire's Avatar
    Join Date
    Jun 2002
    Posts
    4,265
    Thanks
    6
    Thanked 48 Times in 48 Posts
    Here's a good tutorial to get you started with mysql

    http://www.phpfreaks.com/tutorials/33/0.php

    Once you've got some mysql code started and you get stuck, give a shout and we'll try and help you, but of course you'd ask in the mysql forum for that help and not here


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •