kempo Posted May 10, 2007 Author Share Posted May 10, 2007 ok i sorted out the syntax error Link to comment https://forums.phpfreaks.com/topic/50697-music-chart/page/2/#findComment-250013 Share on other sites More sharing options...
kempo Posted May 10, 2007 Author Share Posted May 10, 2007 ok, so a few things i need to know now: how do i sort the table by rating and how do i make it so when a vote button is clicked, it adds a value to that band id's rating?! Link to comment https://forums.phpfreaks.com/topic/50697-music-chart/page/2/#findComment-250035 Share on other sites More sharing options...
kempo Posted May 10, 2007 Author Share Posted May 10, 2007 ok i sorted the table, just need to know how to make a submit button update only the rating of specific bandid by one or so Link to comment https://forums.phpfreaks.com/topic/50697-music-chart/page/2/#findComment-250057 Share on other sites More sharing options...
cmgmyr Posted May 10, 2007 Share Posted May 10, 2007 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 https://forums.phpfreaks.com/topic/50697-music-chart/page/2/#findComment-250109 Share on other sites More sharing options...
kempo Posted May 10, 2007 Author Share Posted May 10, 2007 im not to sure what to do with that, could you explain a bit more please? Link to comment https://forums.phpfreaks.com/topic/50697-music-chart/page/2/#findComment-250119 Share on other sites More sharing options...
kempo Posted May 10, 2007 Author Share Posted May 10, 2007 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 https://forums.phpfreaks.com/topic/50697-music-chart/page/2/#findComment-250122 Share on other sites More sharing options...
cmgmyr Posted May 10, 2007 Share Posted May 10, 2007 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 https://forums.phpfreaks.com/topic/50697-music-chart/page/2/#findComment-250126 Share on other sites More sharing options...
kempo Posted May 10, 2007 Author Share Posted May 10, 2007 if i make it so it adds another row, i can use count to count and add all the votes for each band id? how would i make each votes rateid go up? Link to comment https://forums.phpfreaks.com/topic/50697-music-chart/page/2/#findComment-250130 Share on other sites More sharing options...
cmgmyr Posted May 10, 2007 Share Posted May 10, 2007 when you create the table you should add auto_increment to rateid Link to comment https://forums.phpfreaks.com/topic/50697-music-chart/page/2/#findComment-250133 Share on other sites More sharing options...
kempo Posted May 10, 2007 Author Share Posted May 10, 2007 awesome, i got that working Link to comment https://forums.phpfreaks.com/topic/50697-music-chart/page/2/#findComment-250142 Share on other sites More sharing options...
kempo Posted May 11, 2007 Author Share Posted May 11, 2007 so how do i make the form have a hidden bandid value? Link to comment https://forums.phpfreaks.com/topic/50697-music-chart/page/2/#findComment-250441 Share on other sites More sharing options...
kempo Posted May 11, 2007 Author Share Posted May 11, 2007 ok i've done that, sort of Link to comment https://forums.phpfreaks.com/topic/50697-music-chart/page/2/#findComment-250463 Share on other sites More sharing options...
kempo Posted May 11, 2007 Author Share Posted May 11, 2007 right last thing i need to know, how do i make it so they can only vote once?! Link to comment https://forums.phpfreaks.com/topic/50697-music-chart/page/2/#findComment-250466 Share on other sites More sharing options...
kempo Posted May 11, 2007 Author Share Posted May 11, 2007 also how do i make each band profile realte to their bandid?! so i can link it in the charting system Link to comment https://forums.phpfreaks.com/topic/50697-music-chart/page/2/#findComment-250493 Share on other sites More sharing options...
cmgmyr Posted May 11, 2007 Share Posted May 11, 2007 you would have to make a profile table with bandid profile website ... so you use bandid/userid as a KEY so you can relate that id to multiple tables Link to comment https://forums.phpfreaks.com/topic/50697-music-chart/page/2/#findComment-250681 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.