Well, if I understood correctly, and the IP's first 3 segments are all
of the same length, the you could do something like this (MySQL)
SELECT
SUBSTRING(ip, 1, 11) AS ip,
COUNT(1) AS cantidad
FROM tabla
GROUP BY ip
Now, if you don't intend to do this in SQL, then you could try some of
the other suggestions.
Rob W. wrote:
Ok, Here is my next problem.
Inside my database, I have a list of ip's of about 10 blocks
192.168.100.0 all the way though 255 along with 192.168.101.0 though
255 and 192.168.102.0 though 255 and soforth
My problem is, is i'm trying to figure out a pattern to match so I
can count how many ip's are in each block and display them.
So far what I have gotten is a stristr match but it's not working
correctly. I have a variable that basically weed's out the last
digits of the ip it's self from help previously
So my code so far is:
if (stristr($block,$address)) { $count_ip++; }
$block would == 192.168.100 $address would == 192.168.100.0 - 255
Any help would be appricated.
--
Atentamente / Sincerely,
J. Rafael Salazar Magaña
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php