<code lang="php">
$bg=mysqli_fetch_array($db->query("SELECT * FROM `background` WHERE `id`='1'"));
$photo='<img class="bg" src="data:image/gif; base64,'.base64_encode($bg['background']).'"';
</code>
body{
background-image: url('<?php echo $photo;?>');
width: 100%;
height: 100vh;
}