Jump to content

Invalid use of group function


desithugg

Recommended Posts

[code]
<?
$start = $_GET['start'];
$result = mysql_query("SELECT count(id) FROM s_users");
if (!$result) {
  echo 'Could not run query: ' . mysql_error();
  exit;
}
$total = $row[0];
$totall = ($total-15);
if($total < $start)
{
$start = $totall;
}
if($start < "0")
{
$start = "0";
}
?>
<table border ='0' class='top' width='100%'>
<tr><td class='top'>Rank</a><td class='top'>Username/ID</td><td class='top'>Threads</td><td class='top'>Option</a></tr>
<?php
$query = "SELECT s_users.user,s_users.id,count(threads.id) as posts FROM s_users left join threads on threads.poster = s_users.user order by count(threads.id) DESC limit $start,15";
$result = mysql_query($query) or die(mysql_error());
while($row = mysql_fetch_array($result)) {
$threads = number_format($row['posts']);
echo "<tr><td class='top'>$count</td><td class='top'>". $row['user'] ."/". $row['id'] ."</td><td  class='top'>$threads</td><td  class='top'><a href='index.php?action=view&user=". $row['user'] ."'>View Profile</a><br><a href='forums.php?action=sendpm&senf=". $row['user'] ."'>Send Pm</a><br><a href='tbattle.php?p_id=". $row['user'] ."'>Battle</a></td></tr>";
}
?>
</table>
<table align='center'><tr><th class='rankthing'>
<?
$next = ($start+15);
$last = ($start-15);
?>
[/code]
I keep getting the error [red]Invalid use of group function[/red]
before I had [red]group by s_users.user[/red] and I got that erro but than I removed it but I continue to receive the error
Link to comment
https://forums.phpfreaks.com/topic/29996-invalid-use-of-group-function/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.