Warning: mysql_query() expects parameter 2 to be resource, boolean given in D:\w
Warning: mysql_select_db() expects parameter 2 to be resource, boolean given in D:\wamp\www\get.php on line 9
Warning: mysql_query() expects parameter 2 to be resource, boolean given in D:\wamp\www\get.php on line 11怎么解决?
代码是这样的!
<?php
session_start();
$_SESSION['times'] = null;
if(!isset($times))
{
$times="0";
}
$link=mysql_connect("localhost","root","123456");
mysql_select_db("chatRoom",$link);
$query="select * from chatroom where times>'$times'";
$result=mysql_query($query,$link);
$megs=array();
echo "<script language='JavaScript'>";
while ($row=mysql_fetch_array($result))
{
if($row["times"] >= $times)
{
$time = $row["times"];
}
echo "top.chatUserName[top.lines.length]=".$row['chatUser']."';\n";
echo "top.showTime[top.lines.length]=".$row['times']."';\n";
echo "top.lines[top.lines.length]=".$row['msg']."';\n";
echo "document.write(top.lines.length);";
}
echo"top.list.location.reload();";
echo "</script>";
?>
<html>
<head>
</head>
<body onLoad="windows.setInterval('location.reload()'4000);">
<!--每4秒刷新一次-->
<h1>
<p align=a"center">
聊天室
</p>
</h1>
</body>
</html>
哪错了?求大神帮助。。。。