selective query?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I'm tweaking my internet speed tester thingamabob
(http://www.dibcomputers.com/bandwidthmeter/index.php) and am rather
stumped.  Currently, I'm grouping together all results from each domain (all
results from, say, adelphia.net are averaged and displayed as one, etc) and
to that end I stopped displaying IP address results.  Is there a way I can
do a selective group?  For example, all results from 11.22.33.44 should be
averaged and grouped together, and all results from adelphia.net should be
averaged and grouped as well.

Here's the code I've got that displays all results:

echo "Average speeds of each domain tested:<br>";
$mongo = @mysql_query ("SELECT
substring_index(name,'.',-2),ROUND(MIN(speed),1),ROUND(AVG(speed),1),ROUND(M
AX(speed),1) FROM `readings` WHERE name <> ip GROUP BY
substring_index(name,'.',-2) ORDER BY substring_index(name,'.',-2) ASC");
echo "<table width=100%><tr><td>Domain</td><td>Lowest Speed</td><td>Average
Speed</td><td>Highest Speed</td></tr>\n";
while ($mongorow = mysql_fetch_array($mongo, MYSQL_NUM))
    {
     if($bg=='#dddddd') $bg='#ffffff' ;
     else $bg='#dddddd' ;
     echo "<tr bgcolor=$bg><td><a href=\"http://www.$mongorow[0]\";
target=\"new\">$mongorow[0]</a></td><td>$mongorow[1]</td><td>$mongorow[2]</t
d><td>$mongorow[3]</td></tr>\n";
    }
echo "</table>";


Any ideas?

TIA,
Dan

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux