I'm a highschool student who is not that great at coding, so forgive me if I sound dumb for this or have missed something obvious. So I have div ids that play audio clips when I click on pictures. They go from div5 to div14. When I type in 'div5' directly after 'id =' then it plays my audio. However, I'm trying to make this id change in increments of one (div5,div6,div7 etc). So I tried that loop. I found out that the html wont take the php variable $string, as when I tried it, the picture on my website didn't play audio. The $i doesn't do anything atm. If anyone could help, I would greatly appreciate it.
<?php
$i=5;
while ($row= mysqli_fetch_assoc($result)) {
$string="drag5";
echo '<div style= "width: 100px; height: 100px; margin: 10px;border: 3px
solid #FFFFFF; box-shadow: 10px 10px 5px #888888; float: left"
class="boxes"><img height="100px" width="100px" id="<?php echo $string; ?>"
class="dragg" src="data:image/jpeg;base64,'.base64_encode( $row['source']
).'"/></div>';
$i++;
}
?>