这是一个适合办公室工作人员的小包装。我正在尝试开发一个php
应该mp3
在服务器上运行歌曲并将当前歌曲的歌词(仅)发送到客户端的应用程序。我需要在服务器中随机播放歌曲列表,并且当前歌曲的歌词(在服务器上运行)应该在客户端发送。为此,我做了以下事情(所有事情都在 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
文件名:-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>
现在,上面的代码一切正常,但管理员应该在每次服务器播放歌曲时更新。我需要这个任务自动化。为此,我需要在客户端播放要播放的歌曲列表(来自数据库)及其对应的歌词。该怎么办??提前致谢!!