How to generate query based off from user input

What is the type of foo_id? If this is a custom ID, why you are using uid() func? What value must be evaluated?