The result set you are getting back from the query is an object, but you are trying to use array notation when you assign the values to variables - e.g. $name = htmlentities($row['name']);.
It works but the image doesn’t post and I get the following errors:
[18-Jan-2017 18:36:01 UTC] PHP Warning: htmlentities() expects parameter 1 to be string, array given in /home/path/public_html/facebook/index.php on line 17
[18-Jan-2017 18:36:01 UTC] PHP Warning: htmlentities() expects parameter 1 to be string, array given in /home/path/public_html/facebook/index.php on line 18
[18-Jan-2017 18:36:01 UTC] PHP Warning: htmlentities() expects parameter 1 to be string, array given in /home/path/public_html/facebook/index.php on line 19
[18-Jan-2017 18:36:01 UTC] PHP Warning: htmlentities() expects parameter 1 to be string, array given in /home/path/public_html/facebook/index.php on line 20
[18-Jan-2017 18:36:02 UTC] PHP Catchable fatal error: Object of class mysqli_result could not be converted to string in /home/path/public_html/facebook/index.php on line 81