selective query?

From: Date: Sun, 31 Oct 2004 23:29:37 +0000
Subject: selective query?
Groups: php.db 
Request: Send a blank email to php-db+get-37091@lists.php.net to get a copy of this message
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

« previous php.db (#37091) next »