pixelfish Posted July 1, 2007 Share Posted July 1, 2007 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. Quote Link to comment Share on other sites More sharing options...
DeathStar Posted July 1, 2007 Share Posted July 1, 2007 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. Quote Link to comment Share on other sites More sharing options...
pixelfish Posted July 1, 2007 Author Share Posted July 1, 2007 Wat soek jy? Ek soek help! Counting, sweet, at least I know what I need to do. Now where would I paste that? Into my form php? Seriously I am a noob and it's not looking good for me. Quote Link to comment Share on other sites More sharing options...
DeathStar Posted July 1, 2007 Share Posted July 1, 2007 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. Quote Link to comment Share on other sites More sharing options...
pixelfish Posted July 1, 2007 Author Share Posted July 1, 2007 thanks a lot, your help has set me into the right direction! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.