我想弄一个当没有增加信息的时候,也就是说数据库里面的数据还没有出来,页面就说,还没有增加信息,请增加
大概的想法是这样的$num = mysql_affected_rows ();
if ($num > 0) {如果行就显示
}else{
echo "还没有增加专业";
}但这样会报错
Warning: mysql_affected_rows() [function.mysql-affected-rows]: A link to the server could not be established in D:\wamp\www\student_zhu\department.php on line 10
还没有增加专业而且当我增加了信息以后,仍然显示“还没有增加专业”发一下全部的代码  <form action="department_add.php" method="post">  <input type="text" name="department" />  <input type="submit" name="sub" value="增加"/>  </form><?php $num =mysql_affected_rows ();
if ($num > 0) {?>
<form action="deletes.php" method="get">
  <table>已增加专业:<?phpinclude_once 'conn.php';$sql = "select * from db_department order by id";
$query = mysql_query($sql) or die("执行sql语句失败".mysql_error());
$i=0;
while($row = mysql_fetch_array($query))
{ ?>
<tr>
<td><?php $i++;echo $i.".".$row['department']?></td> <td><a href="deletes.php?id=<?php echo $row['id']?>">删除</a></td>
<td>  </td>
</tr>
<?php}
?></table>  </form>
<?php}else{
echo "还没有增加专业";
}
?>我在想,是不是我的函数用错了,请大家帮帮忙吧,谢谢