The reason you are getting 1 is because of the following line:
echo print_r($result);
You see, how you are using `echo` and `print_r`, so in this case `print_r` is returning `true` which is being typecasted into integer and is being printed as `1` by `echo`.
So, just remove that and it should be fine.