I am a noob to php and coding in general so pardon my ignorance. I am trying to play a wav file from a php if statement. When I echo html for the sound I get this error.
PHP Parse error: syntax error, unexpected '" type="' (T_CONSTANT_ENCAPSED_STRING), expecting ',' or ';' in /var/www/html/colums.php on line 67
line 67 being
echo "<audio autoplay><source src="sounds/beep.wav" type="audio/wav"
autoplay></audio>";
Here is my code:
<?php
$result = $db->query("SELECT * FROM my_table WHERE sound=1");
while($row = $result->fetch_assoc()){
echo $row['sound'];
}
$sound=$row['sound'];
if ($sound = "1"){
echo "<audio autoplay><source src="/sounds/beep.wav"
type="audio/wav" autoplay></audio>";
}
?>
Thanks for your help