I have this script :
$limit1=10;
$MySQL=mysql_connect($myhost,$myuser,$mypass);
mysql_select_db($sitedb);
$rank = mysql_query('SELECT usrid,num FROM 7stat '.' GROUP BY usrid ORDER BY num desc LIMIT '.$limit1.'');
$i=1;
while ($row = mysql_fetch_array($rank))
{
echo '<tr>
<td align="center">'.$row['usrid'].'</td><br>
<td align="center">'.$row['num'].'</td>
</tr> ';
$i++;
}
Basically should show me top 10 surfers but it does not .
In this page can be found the results :
http://123autotraffic.com/12.php
Check last table .
My user ID : 1
I made today 840 credits ( num ) and from start over 30000 but the script shows 52 .
Please help .
CREATE TABLE IF NOT EXISTS `7stat` (
`usrid` int(10) unsigned NOT NULL DEFAULT '0',
`date` date NOT NULL DEFAULT '0000-00-00',
`num` float unsigned NOT NULL DEFAULT '0',
PRIMARY KEY (`usrid`,`date`),
KEY `date` (`date`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
I have to use group because it is a monthly statistic
If is not grouped will show the same user id more times .
Fixed . Big thanks to everyone .
Update the query in your script:
And replace everywhere in your code:
With: