blackenedESP Posted September 4, 2007 Share Posted September 4, 2007 I want to start a website that will allow viewers to rate songs and albums. I'm hosting my site on a free web host that has PHP and MySQL. On the site itself, i'd like a column for my personal rating (i can just statically do that on the website) and next to that have the avarage rating all the visitors have accumulated. So i'm thinking have a little drop down menu that has 1-10, the visitors will choose what they'd like to rate it, click a submit button, and it'll average that rating with the current rating in the database, then output it back to the website. Check out www.metalstorm.ee, pretty much something like that. I'm extremely new to all this stuff so i really need it to be in laymens terms. I'd appreciate any help but if someone could go step by step with me as i'm doing all this, that would be great. Quote Link to comment Share on other sites More sharing options...
fenway Posted September 4, 2007 Share Posted September 4, 2007 What do you have so far? Quote Link to comment Share on other sites More sharing options...
blackenedESP Posted September 5, 2007 Author Share Posted September 5, 2007 Pretty much nothing. The website itself (html stuff), I can do. But I'm assuming I'd need PHP code to write and retrieve data from a database, none of which I know how to do or setup. The main thing I need would be this: Say the viewer is looking at a page for Metallica's Master Of Puppets album, which I would have the track listing for stored in the datebase. He wants to rate Leper Messiah a 9. So he clicks on the drop down menu next to Leper Messiah, chooses 9, and hits a submit button. I would need a code that would send that rating (for that song), to the database, average it with the current rating, and then display the new average on the page. If at all possible, be able to display how many times it's been rated as well. I have a web host, it has PHP and MySQL, but I have no idea what to do from there. How to connect to the database from the website, read & write from it, etc... I'm also not entirely sure how to set up the album listings in the database. Quote Link to comment Share on other sites More sharing options...
blackenedESP Posted September 5, 2007 Author Share Posted September 5, 2007 OK, I found a great tutorial online that really helped me out. I have a table setup in phpMyAdmin. I'm able to connect to it and retrieve the ratings that are already in there. So all I need now is to let the user submit a rating and averaging it in to the current rating (haven't messed with that yet) and displaying the total number of times a song has been rated by users. I'm gonna screw around with the submission part now. I have no idea about the total number of ratings thing though so if someone could help me out with that, i'd really appreciate it. Quote Link to comment Share on other sites More sharing options...
blackenedESP Posted September 6, 2007 Author Share Posted September 6, 2007 Made some more progress. I have my page setup with 8 text boxes the viewers can enter the rating they want for each song (8 songs on this particular album). I would like for them to be able to click the submit button I have and that would take all 8 text box ratings and enter them into my database. I have the album's track listings in the database too so something like WHERE tracknum="01" uses the first text box, WHERE tracknum="02" uses the second text box, etc... I don't know how to have all that happen when they click the submit button though. Also, I'm still clueless about the whole number of votes thing. I'd really like to be able to do that. Quote Link to comment Share on other sites More sharing options...
fenway Posted September 7, 2007 Share Posted September 7, 2007 So the next step is? Quote Link to comment Share on other sites More sharing options...
blackenedESP Posted September 7, 2007 Author Share Posted September 7, 2007 Some code for when the visitors click the submit button, it sends the ratings they put in the text boxes to the database, averages them with the current ratings in the database, then outputs it back to the website. Quote Link to comment Share on other sites More sharing options...
fenway Posted September 8, 2007 Share Posted September 8, 2007 Some code for when the visitors click the submit button, it sends the ratings they put in the text boxes to the database, averages them with the current ratings in the database, then outputs it back to the website. Well, saving form data from php->mysql is pretty common-place, plenty of sample code everywhere for that. As for the calculations, averages have mysql functions. And for the output, well, that's up to you to format. 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.