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.
Have you tried identifying them by their user-agent information? A simple google search should give you the user-agents used by Google etc.
This, of course, is not foolproof, but most crawlers by major companies supply a distinct user-agent.
EDIT: Assuming you do not want to restrict the bots access, but just not count its visit in your statistc.