Hasin Hayder had been working with the Facebook API and stumbled across a bug in an application they had created for the social networking site:
The method which we used to count number of friends of a specific user who has added that application was returning 1 when there is no friend actually installed it.
He gives the SQL query and the PHP code he was originally using to find out the number of users for the application. The problem came from the fact that the returning value wasn't an array - it was a string. The corrected code (that checks for array-ness) is also included.