ok i have this page which processes a form where users vote on a bunch of different categories
[code=php]
<?
// this will put all the form elements into variables
$best_user=$_POST[“best_user”];
$funniest_user=$_POST[“funniest_user”];
$smartest_user=$_POST[“smartest_user”];
$best_icon=$_POST[“best_icon”];
$best_moderator=$_POST[“best_moderator”];
$best_admin=$_POST[“best_admin”];
$most_improved=$_POST[“most_improved”];
$best_new_user=$_POST[“best_new_user”];
$favorite_user=$_POST[“favorite_user”];
$most_helpful_user=$_POST[“most_helpful_user”];
//this will check to see if all form fields are fill out
if($best_user ==”” || $funniest_user ==”” || $smartest_user ==”” || $best_icon ==”” || $best_moderator ==”” || $best_admin ==”” || $most_improved ==”” || $best_new_user ==”” || $favorite_user ==”” || $most_helpful_user ==””)
{
echo”You must fill out all form fields.”;
}
else
{
$linkid= mysql_connect(“localhost”, “”, “”)or die(mysql_error());//connects
mysql_select_db(“ncs_awards”, $linkid) or die(mysql_error());//chooses database
$query = “INSERT INTO `awards` ( `ID` , `best_user` , `fun_user` , `smart_user` , `best_icon` , `best_mod` , `best_admin` , `most_improve` , `best_new` , `fav_user` , `most_help` ) ”
. ” VALUES ( ”, ‘$best_user’, ‘$funniest_user’, ‘$smartest_user’, ‘$best_icon’, ‘$best_moderator’, ‘$best_admin’, ‘$most_improved’, ‘$best_new_user’, ‘$favorite_user’, ‘$most_helpful_user’ );”
. ” “;
mysql_query($query) or die(mysql_error());//inserts into awards table
echo”Your votes have been recorded, have a nice day”;
}
?>
That works fine in inserting all the votes into the db
Then I have this page which selects the vote from the database, this is what i need help with
[code=php]
<?
$linkid= mysql_connect(“localhost”, “root”, “”)or die(mysql_error());//connects
mysql_select_db(“ncs_awards”, $linkid) or die(mysql_error());//chooses database
$query=’SELECT * from awards’;//query to select everything from awards
$result= mysql_query($query);//performs query
while ($row = mysql_fetch_assoc($result))
{
$best_user = $row[‘best_user’];
$fun_user = $row[‘fun_user’];
$smart_user = $row[‘smart_user’];
$best_icon = $row[‘best_icon’];
$best_mod = $row[‘best_mod’];
$best_admin = $row[‘best_admin’];
$most_improve = $row[‘most_improve’];
$best_new = $row[‘best_new’];
$fav_user = $row[‘fav_user’];
$most_help = $row[‘most_help’];
echo'<b>’.$best_user.'</b><br>’;//echoes out the best user
}
?>
For arguments sake lets say that 7 people voted Conor as the best user. Right now that will echo out conor 7 times like this
[b]
Conor
Conor
Conor
Conor
Conor
Conor
Conor
I want it to display like this
[b]
Conor(7)
Is this possible and if so can you point me in the right direction
Thanks,
Conor