2004-08-26, 01:28 PM
I was trying to make my memberlist sorted by ratings by default, I tried to move code around but couldn't get it to work. Any guide to achieve this would be highly appreciated
else
{
$by = "regdate";
}
else
{
$by = "rating";
}
while($users = $db->fetch_array($query))
{
if($users['rating'])
{
$rateinfo = explode("|", $users['rating']);
$users['rating'] = round($rateinfo[0] / $rateinfo[1]);
for($i = 1; $i <= $users['rating']; $i++)
{
$rating .= "<img src=\\"$theme[imgdir]/star.gif\\" border=\\"0\\" title=\\"$users[rating] out of 5\\" />";
}
}
else
{
$rating = "Not Yet Rated";
}
eval("\\$member .= \\"".$templates->get("memberlist_row")."\\";");
unset($rating);
<tr>
<td class="thead"><b>Username:</b></td>
<td class="thead" align="center"><b>E-mail:</b></</td>
<td class="thead" align="center"><b>Website:</b></</td>
<td class="thead"><b>Location:</b></</td>
<td class="thead" align="center"><b>Joined:</b></</td>
<td class="thead"><b>Posts:</b></</td>
</tr>
<tr>
<td class="thead"><b>Username:</b></td>
<td class="thead"><b>Rating:</b></td>
<td class="thead" align="center"><b>E-mail:</b></</td>
<td class="thead" align="center"><b>Website:</b></</td>
<td class="thead"><b>Location:</b></</td>
<td class="thead" align="center"><b>Joined:</b></</td>
<td class="thead"><b>Posts:</b></</td>
</tr>
<form action="memberlist.php" method="post">
<td align="center" colspan="6" class="trow2">
<form action="memberlist.php" method="post">
<td align="center" colspan="7" class="trow2">
<tr>
<td class="trow1"><a href="member.php?action=profile&uid=$users[uid]">$users[username]</a></td>
<td class="trow2">$rating</td>
<td class="trow1">$useremail</td>
<td class="trow2">$usersite</td>
<td class="trow1">$users[location]</td>
<td class="trow2">$users[regdate]</td>
<td class="trow1">$users[postnum]</td>
</tr>
Parse error: parse error, unexpected T_VARIABLE in /home/chiefsaab/public_html/forum/memberlist.php on line 112
if($users['rating'])
{
$rateinfo = explode("|", $users['rating']);
$users['rating'] = round($rateinfo[0] / $rateinfo[1]);
for($i = 1; $i <= $users['rating']; $i++)
{
$rating .= "<img src=\\"$theme[imgdir]/star.gif\\" border=\\"0\\" title=\\"$users[rating] out of 5\\" />";
}
}
else
{
$rating = "Not Yet Rated";
}
eval("\\$member .= \\"".$templates->get("memberlist_row")."\\";");
unset($rating);
<tr>
<td class="trow1"><a href="member.php?action=profile&uid=$users[uid]">$users[username]</a></td>
<td class="trow2">$rating</td>
<td class="trow1">$useremail</td>
<td class="trow2">$usersite</td>
<td class="trow1">$users[location]</td>
<td class="trow2">$users[regdate]</td>
<td class="trow1">$users[postnum]</td>
</tr>