Auto Add BOT IP to Table

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
phphelpme
Forum Contributor
Posts: 261
Joined: Sun Nov 21, 2010 3:32 pm

Auto Add BOT IP to Table

Post by phphelpme »

Hello fellow coders,


Best wishes
Last edited by phphelpme on Sat Feb 25, 2012 2:50 pm, edited 2 times in total.
User avatar
social_experiment
DevNet Master
Posts: 2793
Joined: Sun Feb 15, 2009 11:08 am
Location: .za

Re: Auto Add BOT IP to Table

Post by social_experiment »

I think the problem could be where you use count(); From the php manual
If var is not an array or an object with implemented Countable interface, 1 will be returned. There is one exception, if var is NULL, 0 will be returned.

Code: Select all

$ipresult = mysql_query($ipquery) or die(mysql_error());
This returns a resource which is not what count() accepts; it doesn't give an error but returns 1 instead which is why you are getting 1 each time.

Hth
“Don’t worry if it doesn’t work right. If everything did, you’d be out of a job.” - Mosher’s Law of Software Engineering
phphelpme
Forum Contributor
Posts: 261
Joined: Sun Nov 21, 2010 3:32 pm

Re: Auto Add BOT IP to Table

Post by phphelpme »

Thanks social_experiment for getting back to me. So basically I just need to set up a variable outside the while loop then increment by 1 inside the loop.

Thanks for your assistance.

Best wishes
Post Reply