thankyou for helpin me to understand how it works, i m almost done with my work, but i got a problem now
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<?php
$page = $_SERVER['PHP_SELF'];
$sec = "5";
?>
<html>
<head>
<meta http-equiv="refresh" content="<?php echo $sec?>;URL='<?php echo $page?>'">
</head>
<body>
<script>
function playMusic()
{
document.getElementById('sound1').play();
}
</script>
<form id="f1" name="f1" action="" method="">
<audio id="sound1" src="fire.wav"></audio>
<br>
<input type="button" value="testBtn" onClick="document.getElementById('sound1').pause();">
</form>
<?php
$servername = "localhost";
$username = "root";
$password = "root";
$dbname = "test";
$conn = new mysqli($servername, $username, $password, $dbname);
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
$sql = "SELECT hostname, problem FROM test1";
$result = $conn->query($sql);
if ($result->num_rows > 0) {
// output data of each row
while($row = $result->fetch_assoc()) {
echo "<br> "." name ". $row["hostname"]. " problem ". $row["problem"].date ("Y/m/d") ."<br>";
playMusic();
}
} else {
echo "0 results";
}
$conn->close();
?>
</body>
</html>
on line 38 , i know the code will search database and i cant put my date on, but how can i do it?
do i need to do a for loop or is there a easy ,better way to do it?
and how can i play the soundtrack in line 39....
what is the right way to do it...
btw dont worry about ajax.... i m gonna put it after i make everything works
so there will be ver 2.0
Thankyou so much for the help