I am building stats for my users and dont wish the visits from bots to be counted.
Now I have a basic php with mysql increasing 1 each time the page is called.
You should filter by user-agent strings. You can find a list of about 300 common user-agents given by bots here: http://www.robotstxt.org/db.html Running through that list and ignoring bot user-agents before you run your SQL statement should solve your problem for all practical purposes.
If you don't want the search engines to even reach the page, use a basic robots.txt file to block them.