Re: [PHP] Getting totals

2006-06-07 Thread Rabin Vincent
On 6/7/06, Rob W. [EMAIL PROTECTED] wrote: I got the fix, strstr didnt work right because it was relaying more than just what I was thinking. Here is the fix. $value=array(strstr($block, $address)); foreach ($value as $var) { $block_total_ip++; } How can this work? $value

Re: [PHP] Getting totals

2006-06-07 Thread Rob W.
, June 07, 2006 2:03 AM Subject: Re: [PHP] Getting totals On 6/7/06, Rob W. [EMAIL PROTECTED] wrote: I got the fix, strstr didnt work right because it was relaying more than just what I was thinking. Here is the fix. $value=array(strstr($block, $address)); foreach ($value as $var

Re: [PHP] Getting totals

2006-06-07 Thread Rabin Vincent
On 6/7/06, Rob W. [EMAIL PROTECTED] wrote: Yeah, it counts how many times block is in $address, so if there's 254 ip's listed in the database, it will incriment it 254 times and display that. Well, the code snippet you've shown does NOT do any kind of checking to see if $block is in $address.

Re: [PHP] Getting totals

2006-06-07 Thread Rafael
understanding, That's the way the viarable will look, i'm putting it in as a viariable. if (strstr($block,$address)) { $inc++; } - Original Message - From: Richard Lynch [EMAIL PROTECTED] To: Rob W. [EMAIL PROTECTED] Sent: Tuesday, June 06, 2006 8:58 PM Subject: Re: [PHP] Getting totals

[PHP] Getting totals

2006-06-06 Thread Rob W.
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

Re: [PHP] Getting totals

2006-06-06 Thread Jochem Maas
without actually thinking about your problem I guess that these funcs (the first is most like useful, the second show [at least] how the first can be used and the last func is just for fun) might help you somehow (apologies if If I'm way off base): ALSO: if anyone has a cleaner/faster/better way

Re: [PHP] Getting totals

2006-06-06 Thread Rob W.
PROTECTED] To: Rob W. [EMAIL PROTECTED] Sent: Tuesday, June 06, 2006 1:16 PM Subject: Re: [PHP] Getting totals i may be missing something in your description, but does turning the first and last ipnumber in a block into its integer representation, and then doing the math (subtraction) to get

Re: [PHP] Getting totals

2006-06-06 Thread Rabin Vincent
On 6/6/06, Rob W. [EMAIL PROTECTED] wrote: 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++; }

Re: [PHP] Getting totals

2006-06-06 Thread Richard Lynch
On Tue, June 6, 2006 12:15 pm, Rob W. wrote: Ok, Here is my next problem. Inside my database, I have a list of ip's of about 10 blocks Some databases, such as PostgreSQL, have native data format of IP and functions to deal with them... I don't suppose you are using one of those? :-)

Re: [PHP] Getting totals

2006-06-06 Thread Rob W.
: [PHP] Getting totals On 6/6/06, Rob W. [EMAIL PROTECTED] wrote: 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

Re: [PHP] Getting totals

2006-06-06 Thread Rob W.
: Re: [PHP] Getting totals Put quotes or apostrophes on the strings... if (strstr('192.168.100','192.168.100.10')) { On Tue, June 6, 2006 8:46 pm, Rob W. wrote: if (strstr(192.168.100,192.168.100.10)) { $inc++; } echo $inc; That returns nothing. What am i still doing wrong? - Original

Re: [PHP] Getting totals

2006-06-06 Thread Paul Novitski
At 06:46 PM 6/6/2006, Rob W. wrote: if (strstr(192.168.100,192.168.100.10)) { $inc++; } echo $inc; That returns nothing. What am i still doing wrong? I would use quotation marks to explicitly type these as strings: strstr(192.168.100,192.168.100.10) Paul -- PHP General Mailing

Re: [PHP] Getting totals

2006-06-06 Thread Rabin Vincent
On 6/7/06, Rob W. [EMAIL PROTECTED] wrote: Sorry for the miss understanding, That's the way the viarable will look, i'm putting it in as a viariable. if (strstr($block,$address)) { $inc++; } Like I said before, strstr's argument list is haystack (what to search in) first and then needle

Re: [PHP] Getting totals

2006-06-06 Thread Rob W.
] To: Rob W. [EMAIL PROTECTED] Cc: php-general@lists.php.net Sent: Tuesday, June 06, 2006 11:38 PM Subject: Re: [PHP] Getting totals On 6/7/06, Rob W. [EMAIL PROTECTED] wrote: Sorry for the miss understanding, That's the way the viarable will look, i'm putting it in as a viariable. if (strstr($block