Use a better variable name ($result variable is used for storing query execution result as well)
bug #4161 - Fix PHP errors