PHP-Mysqli example secure?
Yes, that looks good.

Minor comment:  Normally an id is an integer.  Should it have been "i" in your bind_param?

Connection Details

First, I am not a security expert.  However, I would recommend storing the connection details in a location that is not served by your web-server.  It should be somewhere in your PHP include_path or accessible from your autoloader.

Having the file in a directory accessible from your web-server could open up the connection details if you had an incorrectly configured web-server.