Skip to Content
It is currently December 16th, 2019, 6:10 am

All times are UTC - 6 hours [ DST ]




Post new topic Reply to topic  [ 6 posts ] 
Author Message
PostPosted: April 6th, 2019, 2:25 am 
Offline
Senior User
Senior User

Joined: July 23rd, 2007, 2:22 am
Posts: 118
On my site I've installed a working voting system using a thumbs-up or thumbs-down and vote count and it seems to be working, BUT, it asks for the ID of the data to vote on, and when I put either "songID", "$songID", "ID", or "$ID", it doesn't know what that is because when I look at my SQL data it shows that the ID is set to the word "ID", and not the ID number of the song.

For example, the song playing right now has an ID of 12907, but when I vote on this song, I can go back to my SQL and find the vote, but the ID says "ID" instead of the number.

When I look at the "songlist" table I can clearly see the song's ID under the ID column but I can't use it.

What parameter can I pass to the script where SQL will recognize the ID of the song that is currently being played and place that into the ID column in my database? That way it will allow unique voting for each song (I think).

I've contacted the author of the script, but he/she (?) hasn't responded yet.

Here is the webpage: https://coursesweb.net/php-mysql/voting ... _php-mysql

Dan

_________________
Park Magic Radio
http://parkmagicradio.ca


Top
 Profile  
Reply with quote  
PostPosted: April 6th, 2019, 3:01 am 
Offline
Senior User
Senior User

Joined: July 23rd, 2007, 2:22 am
Posts: 118
I got it! The code is:

Code:
<div class="vot_mp2" data-vote_id="<?php echo $currentSong->ID; ?>"></div>

_________________
Park Magic Radio
http://parkmagicradio.ca


Top
 Profile  
Reply with quote  
PostPosted: April 18th, 2019, 12:21 am 
Offline
Senior User
Senior User

Joined: July 23rd, 2007, 2:22 am
Posts: 118
I've been able to tell the voting script to display the vote results for each track, and also to lock the votes after the song has moved out of the Currently Playing box.

The author of the script has updated it to include a parameter to lock the votes once they're in the recently played box or in your playlist.

Here's a link to the newest script: https://coursesweb.net/php-mysql/rating ... jax-php_s2

To have a look at it, please visit my site by clicking on the link below.

Cheers,
Dan

_________________
Park Magic Radio
http://parkmagicradio.ca


Top
 Profile  
Reply with quote  
PostPosted: April 18th, 2019, 12:35 pm 
Offline
SVS Member
SVS Member

Joined: December 6th, 2004, 9:00 am
Posts: 7889
Location: Aachen (Germany)
Interesting take on the concept.
You only allow voting on the currently playing song? Will the votes reset once the song is playing again or are the votes accumulating whenever a track is played again?

I've only ever seen this with ratings possible all over the place.
We built that using the jrating jQuery Plugin: https://www.jqueryscript.net/other/Flex ... ating.html
Sadly the station where we implemented that is no longer online.

_________________
Benedikt Bauer - SVS (Spacial Volunteer Support)

We're offering custom PAL / PHP code and general SAM assistance at palscripts.com

My Project:
Send "Now Playing" from SAM to Twitter and/or Facebook | Sourcecode


Top
 Profile  
Reply with quote  
PostPosted: April 23rd, 2019, 3:21 pm 
Offline
Senior User
Senior User

Joined: July 23rd, 2007, 2:22 am
Posts: 118
Mastacheata wrote:
You only allow voting on the currently playing song?

Yes, only once per song, and I have it set up so that the listener can only rate the song while it's playing. The Playlist page will show you the rating in the far right column. (I have to play around with this because the page data is starting to get too cluttered). Anyone can rate the currently playing song at any time.

Mastacheata wrote:
Will the votes reset once the song is playing again or are the votes accumulating whenever a track is played again?

It's accumulating. So if multiple users rate the same song, the database will store all ratings. Ratings won't reset after the song is played, and if you rated a song, you can't rate it again once it's been played (e.g. in the Recently Played or in the Playlist). After you've rated a song, you can't rate the same song again if your IP address is the same until 24 hours has passed.

Mastacheata wrote:
We built that using the jrating jQuery Plugin: https://www.jqueryscript.net/other/Flex ... ating.html

This script essentially does the same thing. I looked at your code, and it's very similar to what I have.

Dan

_________________
Park Magic Radio
http://parkmagicradio.ca


Top
 Profile  
Reply with quote  
PostPosted: April 24th, 2019, 2:50 am 
Offline
Senior User
Senior User

Joined: July 23rd, 2007, 2:22 am
Posts: 118
I moved the rating script to below a horizontal rule <hr> tag. It looks a little less cluttered. Still not happy with where it's placed though, but it looks better.

_________________
Park Magic Radio
http://parkmagicradio.ca


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 6 posts ] 

All times are UTC - 6 hours [ DST ]


Who is online

Users browsing this forum: Bing [Bot], MSN [Bot] and 12 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group