This is an small package for an office staffs. I am trying to develop a php
application that should run mp3
song on server and send the lyrics of the current song(only) to the client side. I need to play list of songs randomly in server and the lyrics of current song(running on server) should be sent on client side. For this I have done following things(all things are done in localhost)::
database name:album
table name: song(id,name,lyrics,status)
Note: this is manual update done by admin::
filename: - admin.php
$id = $_POST['id'];
mysqli_query($con,"update album set status=0");//all song status cleared
mysqli_query($con,"update album set status=1 where id=$id");//status with value 1 is playing on server
filename: - client.php
<html>
<meta http-equiv="refresh" content="1" >
<body align="center" bgcolor="skyblue">
<?php
$con=mysqli_connect("localhost","root","root","test");
// Check connection
if (mysqli_connect_errno())
{
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
//echo $id;
$result = mysqli_query($con,"select name,lyrics from album where album.status=1");
//echo last_query();die;
while($row = mysqli_fetch_array($result))
{
echo "<h1>".$row['name']."</h1>";
echo "<br />";
echo "<h3>".$row['lyrics']."</h3>";
}
mysqli_close($con);
?>
</body>
</html>
Now, everything is okay with above code but the admin should update each time which song is playing in server. I need this task automated. For this, i need to play list of songs(from database) to be played and their corresponding lyrics in client side. What to do?? Thanks in advance!!