vote

Return list of current Facebook user's friends PHP

时间秒杀一切 提交于 2019-12-01 11:13:45
问题 I am working on a Facebook app that will allows users to vote on their favorite pictures, based on their friend's profiles pictures. I know how to display the images, just not how to get the list of the current user's friend's IDs. My application is written in PHP. This is the last thing I need to complete the app. Any help would be great! This is my code: (Just to display each user ID on the page) <?php include_once 'facebook.php'; $apikey = 'API KEY HERE'; $secretkey = 'SECRET KEY HERE';

PHP voting, one vote per IP per day: code help needed

旧城冷巷雨未停 提交于 2019-12-01 11:10:47
问题 I am working on a very basic site which will allow people to vote once per 24 hours on an item (game) per IP address. Votes are stored in a table named votes, with columns containing vote ID, game ID, votedate, and IP address. Users go to the vote page for that game via ...vote.php?id=# (where # is the gid). Here is a simplified version of my current vote.php, which is not working: <?php $gid = $_GET["id"]; $ip = $_SERVER['REMOTE_ADDR']; require_once ('config.php'); $q = "SELECT * FROM votes

How to calculate average on star rating system?

核能气质少年 提交于 2019-11-30 15:30:50
I am developing a star rating system with 1-5 stars. In my database I am saving them like this: $stars_1 = 1; $stars_2 = 6; $stars_3 = 3; $stars_4 = 11; $stars_5 = 22; $total_votes = 43 When a user votes using for example 3 stars I update stars_3 with 1 and total_votes with 1. Then I need to calculate the average rating (stars). I do it like this right now but I is not working (result seems wrong): (($stars_1 + $stars_2 + $stars_3 + $stars_4 + $stars_4) / $total_votes); Needs to be like this: ($stars_1 + $stars_2 * 2 + $stars_3 * 3 + $stars_4 * 4 + $stars_5 * 5) / $total_votes; Tobias You need

How to calculate average on star rating system?

狂风中的少年 提交于 2019-11-29 21:18:45
问题 I am developing a star rating system with 1-5 stars. In my database I am saving them like this: $stars_1 = 1; $stars_2 = 6; $stars_3 = 3; $stars_4 = 11; $stars_5 = 22; $total_votes = 43 When a user votes using for example 3 stars I update stars_3 with 1 and total_votes with 1. Then I need to calculate the average rating (stars). I do it like this right now but I is not working (result seems wrong): (($stars_1 + $stars_2 + $stars_3 + $stars_4 + $stars_4) / $total_votes); 回答1: Needs to be like