contra10 Posted February 19, 2009 Share Posted February 19, 2009 i want to have the ability to display a message if the user has allowed only a certain type of people to vote right now my code displays only the message in this case is displaying "...user is only allowing frieds to vote"...I'm testing as a friend and the rating system isn't showing, i checked my database and the user under which i am signed in is a friend of the user i am voting on <?php $query= "SELECT * FROM `users` WHERE `id` = '$id'"; $result = mysql_query($query) or die(mysql_error());; while($response = mysql_fetch_assoc($result)){ $usernameop= "{$response['username']}"; $usercity = "{$response['city']}"; } $friendq= "SELECT * FROM friends WHERE username = '$usernameop'"; $friendnames = mysql_query($friendq) or die(mysql_error()); while($friend = mysql_fetch_array($friendnames)) { $friendusername= "{$friend['friendname']}"; } $query3= "SELECT * FROM `vote_ability` WHERE `username` = '$usernameop'"; $result3 = mysql_query($query3) or die(mysql_error());; while($response3 = mysql_fetch_assoc($result3)){ $valueofvoting= "{$response3['value']}"; } if ($valueofvoting == "allowall"){ echo"<input type='radio' name='rating' value='1' >1"; echo"<input type='radio' name='rating' value='2' >2"; echo"<input type='radio' name='rating' value='3' >3"; echo"<input type='radio' name='rating' value='4' >4"; echo"<input type='radio' name='rating' value='5' checked>5"; echo"<input type='radio' name='rating' value='6' >6"; echo"<input type='radio' name='rating' value='7' >7"; echo"<input type='radio' name='rating' value='8' >8"; echo"<input type='radio' name='rating' value='9' >9"; echo"<input type='radio' name='rating' value='10' >10"; echo"<input type='hidden' name='idofrate' value='$id'>"; echo "<input type='submit' name='submit' value='rate'>"; } elseif($valueofvoting == "allowfriends"){ if ($username == $friendusername){ echo"<input type='radio' name='rating' value='1' >1"; echo"<input type='radio' name='rating' value='2' >2"; echo"<input type='radio' name='rating' value='3' >3"; echo"<input type='radio' name='rating' value='4' >4"; echo"<input type='radio' name='rating' value='5' checked>5"; echo"<input type='radio' name='rating' value='6' >6"; echo"<input type='radio' name='rating' value='7' >7"; echo"<input type='radio' name='rating' value='8' >8"; echo"<input type='radio' name='rating' value='9' >9"; echo"<input type='radio' name='rating' value='10' >10"; echo"<input type='hidden' name='idofrate' value='$id'>"; echo "<input type='submit' name='submit' value='rate'>"; } else { echo "$usernameop is only allowing friends to vote on photos"; } } echo"</form>"; ?> 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.