Jump to content

Is it possible to do something like this?


pixelfish

Recommended Posts

Hi,

 

I'm a super php housewife noob that needs some help.  I'm trying to simplify my voting/elimination website.  What we have now is about 10 categories.  Under each category there are 20 options.  Voters can pick 5 options and then submit their picks through a form. I'm using php formmail and have that set up and working great.

 

What we were going to do is count all the votes by hand and then post the top 5 picks and then have the finals where they pick their top 3 choices, 1 being most favorite - 3 least favorite.  Is it possible to do something like this automatically with tables and mysql?  Can I find scripts already set up for something like this?

 

Another thing I'd like to do is limit voters to one vote per category.  I have a hidden env_report value in my form html that logs IP addresses and includes that in the e-mail generated from the form.  What I'd would like to do is have tables set up that logs IP address per category so that I can eliminate multiple votes.  Is this possible?

 

thanks so much, I'm so confused.

Link to comment
Share on other sites

Firstly, No one is a 'noob' they are simply beginners. :)

 

for the counting you can do COUNT or num rows.

 

Example of Count:

$query = 'SELECT COUNT(row) FROM table_name WHERE cat=' . $cat;
$do = mysql_query($query);
echo $do['row'];
// Output: 5

Example of num rows:

$query = 'SELECT row FROM table_name WHERE cat=' . $cat;
$get_rows = mysql_num_rows($query);
echo $get_rows;

 

The IP based system could be bypassed, many people use proxies these days.

 

Hope that helps.

Link to comment
Share on other sites

Dan gee ek help. :)

 

You can simply put that code where you want to display it.

But you need to modify the query according to your database.

 

row - the entries of the row you want to count.

table_name - the table where the row lies in.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.