在这里,我尝试使用从其他表中提取的信息将数据输入到表播放列表中。执行后,我收到“成功”消息,但实际上并没有插入数据..有人能指出错误吗?
<?php
$connect= mysql_connect("localhost","root","") or die('couldnt connect to database');
mysql_select_db("music") or die("couldn't find the database");
$regis['id']=$_GET['id'];
$regis['username']=$_GET['username'];
$query="SELECT * FROM songs WHERE id ='id'";
$quer="SELECT * FROM images WHERE id ='id'";
$q="SELECT * FROM users WHERE username ='username'";
$query=mysql_query($query);
$quer=mysql_query($quer);
$q=mysql_query($q);
$row=mysql_fetch_assoc($query);
$regis['id']=$row['id'];
$regis['title']=$row['title'];
$regis['artist']=$row['artist'];
$rows=mysql_fetch_assoc($q);
$regis['link']=$rows['link'];
$r=mysql_fetch_assoc($q);
$regis['uid']=$r['uid'];
$sql="insert into playlist (songid,song,image,album,uid) values('{$regis['id']}','{$regis['title']}','{$regis['link']}','{$regis['artist']}','{$regis['uid']}')";
$res=mysql_query($sql);
if($res)
{
echo "<script type='text/javascript'>";
echo 'alert("addition to your playlist was succesful")';
echo "</script>";
}
else
{
echo "<script type='text/javascript'>";
echo 'alert("'.mysql_error().'Please try again")';
echo "</script>";
}
?>