Jump to content

Music Chart


kempo

Recommended Posts

you would set the action of the form to something like "do_rate.php"

 

do_rate.php

<?php

$rating = $_POST['rating'];
$bandid = $_POST['bandid'];

$sql = "INSERT INTO rate (rating,bandid) VALUES ('$rating', '$bandid')";
mysql_query($sql);

echo "Thank you for rating!";

?>

Link to comment
Share on other sites

wont that just make it add another row, wouldnt it be easier to have all the rows already there, and have the vote update only the rating in that row, so say

 

rateid  bandid  rating

1        1          0

2        2          0

 

then a user votes for bandid 1 and the table stays the same but

 

 

rateid  bandid  rating

1        1          1

2        2          0

 

a 1 gets added to the rating

Link to comment
Share on other sites

yes that would add another row. another way that you can do it is with an update. but then you will have to enter a "totals" column to have the total amount of votes then calculate the average with "rating" and "totals"

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.