Parse error: syntax error, unexpected below code

I'm getting an error!

Parse error: syntax error, unexpected '{' in C:\wamp64\www\playground\back.php on line 54

Please guide me if there is any resource where I can learn how to indent properly!

<!doctype html>
<a href="front.php">Go to Frontend.</a>
<div><form method="post" enctype="multipart/form-data">
<input type="file" name="image"/>
<input type="submit" name="submit" value="upload">

$con = mysqli_connect("localhost","root","","db_test");
if (mysqli_connect_errno())
echo "Failed to connect to MySQL: " . mysqli_connect_error();
// Logic
if(getimagesize($_FILES['image']['tmp_name'])== FALSE)
echo "Please select an image";
else {
$image= addslashes($_FILES['image']['tmp_name']);
$name= addslashes($_FILES['image']['tmp_name']);
$image= file_get_contents($image);
$image= base64_encode ($image);

function saveimage($name,$image)
$qry="insert into db_test_table (name,image) value ('$name','$image')";

function displayimage(){

$qry="select * from images";
white($row= mysqli_fetch_array(result))

echo '<img height="300" width="300" src="data:image;base64,'.$row[2]'"> ';




I'm new to development and no idea why I'm getting this error, I was trying to copy mysql code and to convert it to mysqli but no luck.

Thanks for help. This is my first stackoverflow post :)